[Python-checkins] cpython (3.2): Issue #12400: regrtest, force verbose mode to True with option -W

victor.stinner python-checkins at python.org
Wed Jun 29 15:38:48 CEST 2011


http://hg.python.org/cpython/rev/2d07b1b4466a
changeset: 71070:2d07b1b4466a
branch: 3.2
parent: 71068:6c54c334ea7a
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Wed Jun 29 15:34:48 2011 +0200
summary:
 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.
files:
 Lib/test/regrtest.py | 17 ++++++++++-------
 1 files changed, 10 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
@@ -784,29 +784,32 @@
 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
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /