diff options
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-x | Lib/test/regrtest.py | 17 |
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 |