diff options
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-x | Lib/test/regrtest.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index c77abc34a3..9c832215e4 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -244,7 +244,14 @@ def runtest(test, generate, verbose, quiet, testdir = None): if cfp: sys.stdout = cfp print test # Output file starts with test name - __import__(test, globals(), locals(), []) + the_module = __import__(test, globals(), locals(), []) + # Most tests run to completion simply as a side-effect of + # being imported. For the benefit of tests that can't run + # that way (like test_threaded_import), explicitly invoke + # their test_main() function (if it exists). + indirect_test = getattr(the_module, "test_main", None) + if indirect_test is not None: + indirect_test() if cfp and not (generate or verbose): cfp.close() finally: |