summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 13:34:48 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 13:34:48 (GMT)
commitea95de75dd2a01e424e935f06d871067df99a6ed (patch)
tree608006a39a8335506d7bfd6a88f553934058bf16 /Lib/test/regrtest.py
parent8313d6aef856f8e0c716578c41048e317e0f0ad7 (diff)
downloadcpython-ea95de75dd2a01e424e935f06d871067df99a6ed.zip
cpython-ea95de75dd2a01e424e935f06d871067df99a6ed.tar.gz
cpython-ea95de75dd2a01e424e935f06d871067df99a6ed.tar.bz2
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.
Diffstat (limited to 'Lib/test/regrtest.py')
-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 bb3e703..75d8795 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -784,29 +784,32 @@ def runtest(test, verbose, quiet,
if use_resources is not None:
support.use_resources = use_resources
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