From 569ca27293eec89b5b41c3a12e6531d3eddf0e1b Mon Sep 17 00:00:00 2001 From: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com> Date: Thu, 8 Sep 2022 23:46:13 -0400 Subject: [PATCH] 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. --- Lib/test/test_unittest/testmock/testpatch.py | 2 +- .../next/Tests/2022-09-08-18-31-26.gh-issue-96624.5cANM1.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Tests/2022-09-08-18-31-26.gh-issue-96624.5cANM1.rst diff --git a/Lib/test/test_unittest/testmock/testpatch.py b/Lib/test/test_unittest/testmock/testpatch.py index 93ec0ca4bef..8ceb5d973e1 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 00000000000..2d1bcc03e1c --- /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``.