From: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com> Date: Fri, 9 Sep 2022 03:46:13 +0000 (-0400) Subject: gh-96624: Fix test_dotted_but_module_not_loaded in testpatch.py (GH-96691) X-Git-Tag: v3.12.0a1~441 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=569ca27293eec89b5b41c3a12e6531d3eddf0e1b;p=thirdparty%2FPython%2Fcpython.git gh-96624: Fix test_dotted_but_module_not_loaded in testpatch.py (GH-96691) * Update test_dotted_but_module_not_loaded to reflect the move of unittest.test to test.test_unittest. --- diff --git a/Lib/test/test_unittest/testmock/testpatch.py b/Lib/test/test_unittest/testmock/testpatch.py index 93ec0ca4bef5..8ceb5d973e1a 100644 --- a/Lib/test/test_unittest/testmock/testpatch.py +++ b/Lib/test/test_unittest/testmock/testpatch.py @@ -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 index 000000000000..2d1bcc03e1c8 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-09-08-18-31-26.gh-issue-96624.5cANM1.rst @@ -0,0 +1 @@ +Fixed the failure of repeated runs of ``test.test_unittest`` caused by side effects in ``test_dotted_but_module_not_loaded``.