mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #11653: fix -W with -j in regrtest.
This commit is contained in:
commit
f3c524d535
2 changed files with 16 additions and 7 deletions
|
|
@ -542,7 +542,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
||||||
args_tuple = (
|
args_tuple = (
|
||||||
(test, verbose, quiet),
|
(test, verbose, quiet),
|
||||||
dict(huntrleaks=huntrleaks, use_resources=use_resources,
|
dict(huntrleaks=huntrleaks, use_resources=use_resources,
|
||||||
debug=debug)
|
debug=debug, rerun_failed=verbose3)
|
||||||
)
|
)
|
||||||
yield (test, args_tuple)
|
yield (test, args_tuple)
|
||||||
pending = tests_and_args()
|
pending = tests_and_args()
|
||||||
|
|
@ -616,11 +616,9 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
||||||
globals=globals(), locals=vars())
|
globals=globals(), locals=vars())
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
result = runtest(test, verbose, quiet, huntrleaks, debug)
|
result = runtest(test, verbose, quiet, huntrleaks, debug,
|
||||||
|
rerun_failed=verbose3)
|
||||||
accumulate_result(test, result)
|
accumulate_result(test, result)
|
||||||
if verbose3 and result[0] == FAILED:
|
|
||||||
print("Re-running test {} in verbose mode".format(test))
|
|
||||||
runtest(test, True, quiet, huntrleaks, debug)
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
interrupted = True
|
interrupted = True
|
||||||
break
|
break
|
||||||
|
|
@ -765,7 +763,8 @@ def replace_stdout():
|
||||||
atexit.register(restore_stdout)
|
atexit.register(restore_stdout)
|
||||||
|
|
||||||
def runtest(test, verbose, quiet,
|
def runtest(test, verbose, quiet,
|
||||||
huntrleaks=False, debug=False, use_resources=None):
|
huntrleaks=False, debug=False, use_resources=None,
|
||||||
|
rerun_failed=False):
|
||||||
"""Run a single test.
|
"""Run a single test.
|
||||||
|
|
||||||
test -- the name of the test
|
test -- the name of the test
|
||||||
|
|
@ -774,6 +773,7 @@ def runtest(test, verbose, quiet,
|
||||||
test_times -- a list of (time, test_name) pairs
|
test_times -- a list of (time, test_name) pairs
|
||||||
huntrleaks -- run multiple times to test for leaks; requires a debug
|
huntrleaks -- run multiple times to test for leaks; requires a debug
|
||||||
build; a triple corresponding to -R's three arguments
|
build; a triple corresponding to -R's three arguments
|
||||||
|
rerun_failed -- if true, re-run in verbose mode when failed
|
||||||
|
|
||||||
Returns one of the test result constants:
|
Returns one of the test result constants:
|
||||||
INTERRUPTED KeyboardInterrupt when run under -j
|
INTERRUPTED KeyboardInterrupt when run under -j
|
||||||
|
|
@ -788,7 +788,14 @@ def runtest(test, verbose, quiet,
|
||||||
if use_resources is not None:
|
if use_resources is not None:
|
||||||
support.use_resources = use_resources
|
support.use_resources = use_resources
|
||||||
try:
|
try:
|
||||||
return runtest_inner(test, verbose, quiet, huntrleaks, debug)
|
result = runtest_inner(test, verbose, quiet, huntrleaks, debug)
|
||||||
|
if result[0] == FAILED and rerun_failed:
|
||||||
|
cleanup_test_droppings(test, verbose)
|
||||||
|
sys.stdout.flush()
|
||||||
|
sys.stderr.flush()
|
||||||
|
print("Re-running test {} in verbose mode".format(test))
|
||||||
|
runtest(test, True, quiet, huntrleaks, debug)
|
||||||
|
return result
|
||||||
finally:
|
finally:
|
||||||
cleanup_test_droppings(test, verbose)
|
cleanup_test_droppings(test, verbose)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,6 +293,8 @@ Tools/Demos
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #11653: fix -W with -j in regrtest.
|
||||||
|
|
||||||
- The email test suite now lives in the Lib/test/test_email package. The test
|
- The email test suite now lives in the Lib/test/test_email package. The test
|
||||||
harness code has also been modernized to allow use of new unittest features.
|
harness code has also been modernized to allow use of new unittest features.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue