[Python-checkins] cpython (merge 3.2 -> default): Issue #11653: fix -W with -j in regrtest.
antoine.pitrou
python-checkins at python.org
Wed Mar 23 23:05:18 CET 2011
http://hg.python.org/cpython/rev/c381b35e4f31
changeset: 68885:c381b35e4f31
parent: 68882:59127dcefd87
parent: 68884:53f80427f105
user: Antoine Pitrou <solipsis at pitrou.net>
date: Wed Mar 23 23:05:07 2011 +0100
summary:
Issue #11653: fix -W with -j in regrtest.
files:
Lib/test/regrtest.py | 21 ++++++++++++++-------
Misc/NEWS | 2 ++
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -542,7 +542,7 @@
args_tuple = (
(test, verbose, quiet),
dict(huntrleaks=huntrleaks, use_resources=use_resources,
- debug=debug)
+ debug=debug, rerun_failed=verbose3)
)
yield (test, args_tuple)
pending = tests_and_args()
@@ -616,11 +616,9 @@
globals=globals(), locals=vars())
else:
try:
- result = runtest(test, verbose, quiet, huntrleaks, debug)
+ result = runtest(test, verbose, quiet, huntrleaks, debug,
+ rerun_failed=verbose3)
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:
interrupted = True
break
@@ -765,7 +763,8 @@
atexit.register(restore_stdout)
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.
test -- the name of the test
@@ -774,6 +773,7 @@
test_times -- a list of (time, test_name) pairs
huntrleaks -- run multiple times to test for leaks; requires a debug
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:
INTERRUPTED KeyboardInterrupt when run under -j
@@ -788,7 +788,14 @@
if use_resources is not None:
support.use_resources = use_resources
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:
cleanup_test_droppings(test, verbose)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -293,6 +293,8 @@
Tests
-----
+- Issue #11653: fix -W with -j in regrtest.
+
- 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.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list