-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
python -m test test_unitttest -R3:3 fails #96624
Comments
For convenience, here are those tests: cpython/Lib/test/test_unittest/test_loader.py Lines 580 to 600 in 56d9cf7
cpython/Lib/test/test_unittest/test_loader.py Lines 1005 to 1025 in 56d9cf7
cpython/Lib/test/test_unittest/test_loader.py Lines 704 to 720 in 56d9cf7
|
It appears to be something a bad interaction between those three test methods and cpython/Lib/test/test_unittest/testmock/testpatch.py Lines 1916 to 1932 in 56d9cf7
|
Here's the bare essentials of what is failing: import sys
from unittest.mock import patch
if 0: # change to 1 to see "tu.dummy" fail.
# Inline test_dotted_but_module_not_loaded
# This exercises the AttributeError branch of _dot_lookup.
# make sure it's there
import test.test_unittest.testmock.support
# now make sure it's not:
with patch.dict('sys.modules'):
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']
# now make sure we can patch based on a dotted path:
@patch('test.test_unittest.testmock.support.X')
def test(mock):
print(mock)
test()
# The part that fails in test_loadTestsFromName__module_not_loaded
module_name = 'test.test_unittest.dummy'
sys.modules.pop(module_name, None)
tu = __import__(module_name).test_unittest
tu.dummy So essentially, I believe |
@ezio-melotti or @gpshead or @cjw296, any suggestions on how to make |
Maybe save/restore sys.modules? |
…6691) * Update test_dotted_but_module_not_loaded to reflect the move of unittest.test to test.test_unittest.
I believe this is fixed now. |
Oh nice, thanks for the fix! |
For the last couple months, it seems buildbots have been failing
-m test test_unittest -R3:3
, then re-trying the 3 failed test cases and passing on the re-try. Look at https://buildbot.python.org/all/#/builders/123 for example. The tests consistently pass the first warmup run, then fail on the second warmup run.Example stdout from running
-m test test_unittest -R3:3 -v
:I bisected to here:
cc @vstinner
The text was updated successfully, but these errors were encountered: