Fred Drake opened an irritating <wink> bug report (#112436). Cut to the chase: regrtest.py imports test_support. test_support.verbose is 1 after that. regrtest's main() reaches into test_support and stomps on test_support.verbose, usually setting to 0. Now in my build directory, if I run python ..\lib\test\regrtest.py test_getopt the test passes. However, it *shouldn't* (and the crux of Fred's bug report is that it does fail when he runs regrtest in an old & deprecated way). What happens is that test_getopt.py has this near the top: from test.test_support import verbose and this is causing *another* copy of the test_support module to get loaded, and *its* verbose attr is 1. So when we run test_getopt "normally" via regrtest, it incorrectly believes that verbose is 1, and the "expected result" file (which I generated via regrtest -g) is in fact verbose-mode output. If I change the import at the top of test_getopt.py to from test import test_support from test_support import verbose then test_getopt.py sees the 0 it's supposed to see. The story is exactly the same, btw, if I run regrtest while *in* the test directory (so this has nothing to do with that I usually run regrtest from my build directory). Now what *Fred* does is equivalent to getting into a Python shell and typing >>> from test import regrtest >>> regrtest.main() and in *that* case (the original) test_getopt sees the 0 it's supposed to see. I confess I lost track how fancy Python imports work a long time ago. Can anyone make sense of these symptoms? Why is a 2nd version of test_support getting loaded, and why only sometimes?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4