]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96624: Fix test_dotted_but_module_not_loaded in testpatch.py (GH-96691)
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
Fri, 9 Sep 2022 03:46:13 +0000 (23:46 -0400)
committerGitHub <noreply@github.com>
Fri, 9 Sep 2022 03:46:13 +0000 (23:46 -0400)
* Update test_dotted_but_module_not_loaded to reflect the move of unittest.test to test.test_unittest.

Lib/test/test_unittest/testmock/testpatch.py
Misc/NEWS.d/next/Tests/2022-09-08-18-31-26.gh-issue-96624.5cANM1.rst [new file with mode: 0644]

index 93ec0ca4bef52414c4bfcf99257bf27cc759583e..8ceb5d973e1aafb702b1db680069697d3aaaf9c3 100644 (file)
@@ -1923,7 +1923,7 @@ class PatchTest(unittest.TestCase):
             del sys.modules['test.test_unittest.testmock.support']
             del sys.modules['test.test_unittest.testmock']
             del sys.modules['test.test_unittest']
-            del sys.modules['unittest']
+            del sys.modules['test']
 
             # now make sure we can patch based on a dotted path:
             @patch('test.test_unittest.testmock.support.X')
diff --git a/Misc/NEWS.d/next/Tests/2022-09-08-18-31-26.gh-issue-96624.5cANM1.rst b/Misc/NEWS.d/next/Tests/2022-09-08-18-31-26.gh-issue-96624.5cANM1.rst
new file mode 100644 (file)
index 0000000..2d1bcc0
--- /dev/null
@@ -0,0 +1 @@
+Fixed the failure of repeated runs of ``test.test_unittest`` caused by side effects in ``test_dotted_but_module_not_loaded``.