summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 13:38:18 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 13:38:18 (GMT)
commitba089050624ccdff841a3eea88f0f13bfa0a437b (patch)
tree34e6a5723d7d0a7a4e061681c42e1d90e1dee26b
parentd71bd9a9a472df2010f2b05a588493157aa9ffcb (diff)
parentea95de75dd2a01e424e935f06d871067df99a6ed (diff)
downloadcpython-ba089050624ccdff841a3eea88f0f13bfa0a437b.zip
cpython-ba089050624ccdff841a3eea88f0f13bfa0a437b.tar.gz
cpython-ba089050624ccdff841a3eea88f0f13bfa0a437b.tar.bz2
(merge 3.2) Issue #12400: regrtest, force verbose mode to True with option -W
If verbose is False, the output is empty. Fix also a typo in a variable name.
-rwxr-xr-xLib/test/regrtest.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index d64494ed..4d13fc7 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -838,29 +838,32 @@ def runtest(test, verbose, quiet,
if use_timeout:
faulthandler.dump_tracebacks_later(timeout, exit=True)
try:
- support.verbose = verbose # Tell tests to be moderately quiet
if output_on_failure:
+ support.verbose = True
+
+ # Reuse the same instance to all calls to runtest(). Some
+ # tests keep a reference to sys.stdout or sys.stderr
+ # (eg. test_argparse).
if runtest.stringio is None:
- # Reuse the same instance to all calls to runtest(). Some
- # tests keep a reference to sys.stdout or sys.stderr
- # (eg. test_argparse).
runtest.stringio = io.StringIO()
+ stream = runtest.stringio
orig_stdout = sys.stdout
orig_stderr = sys.stderr
try:
- sys.stdout = runtest.stringio
- sys.stderr = runtest.stringio
+ sys.stdout = stream
+ sys.stderr = stream
result = runtest_inner(test, verbose, quiet, huntrleaks,
debug, display_failure=False)
if result[0] == FAILED:
- output = stringio.getvalue()
+ output = stream.getvalue()
orig_stderr.write(output)
orig_stderr.flush()
finally:
sys.stdout = orig_stdout
sys.stderr = orig_stderr
else:
+ support.verbose = verbose # Tell tests to be moderately quiet
result = runtest_inner(test, verbose, quiet, huntrleaks, debug,
display_failure=not verbose)
return result