Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-96624: Fix test_dotted_but_module_not_loaded in testpatch.py #96691

Merged
merged 2 commits into from Sep 9, 2022

Conversation

sweeneyde
Copy link
Member

@sweeneyde sweeneyde commented Sep 8, 2022

This seems to reflect better the original meaning of the code before c735d54, and it should fix the consistent warning on most refleak buildbots.

@sweeneyde sweeneyde requested a review from cjw296 as a code owner Sep 8, 2022
@sweeneyde sweeneyde changed the title Fix test_dotted_but_module_not_loaded in testpatch.py gh-96624: Fix test_dotted_but_module_not_loaded in testpatch.py Sep 8, 2022
@sweeneyde sweeneyde requested review from vstinner and ezio-melotti Sep 8, 2022
@sweeneyde sweeneyde added the 🔨 test-with-buildbots Test the PR with the buildbot fleet and report in the status section label Sep 8, 2022
@bedevere-bot
Copy link

bedevere-bot commented Sep 8, 2022

🤖 New build scheduled with the buildbot fleet by @sweeneyde for commit dff1c60 🤖

If you want to schedule another build, you need to add the "🔨 test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test the PR with the buildbot fleet and report in the status section label Sep 8, 2022
@sweeneyde
Copy link
Member Author

sweeneyde commented Sep 8, 2022

All of the refleak buildbots that ran no longer have the warnings about failing and re-trying test_unittest.

Unfortunately, they all emit at least one other warning (#96696), so they're still "orange", not green.

Copy link
Member

@ezio-melotti ezio-melotti left a comment

LGTM.

This seems to reflect better the original meaning of the code before c735d54,

Specifically this bit: c735d54#diff-a166f2dc69b03117686d52e8c67698b174f612d6e57c692a74d5f4cce1798c84L1922-L1926

         # make sure it's there
-        import unittest.test.testmock.support
+        import test.test_unittest.testmock.support
         # now make sure it's not:
         with patch.dict('sys.modules'):
-            del sys.modules['unittest.test.testmock.support']
-            del sys.modules['unittest.test.testmock']
-            del sys.modules['unittest.test']
+            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']

@sweeneyde sweeneyde merged commit 569ca27 into python:main Sep 9, 2022
82 checks passed
@sweeneyde sweeneyde deleted the testpatch_fix branch Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants