diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-29 15:53:11 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-29 15:53:11 +0200 |
commit | 05d34fc9533eb71052be2ecac3882d658cf6dd71 (patch) | |
tree | 3cf06bc6519494d732c501293724994d0a2b159b | |
parent | ba089050624ccdff841a3eea88f0f13bfa0a437b (diff) | |
parent | bddc4d4607a26603b2171f0663c506c8994e0a5b (diff) | |
download | cpython-git-05d34fc9533eb71052be2ecac3882d658cf6dd71.tar.gz |
Issue #12400: test.support.run_doctest() doesn't change sys.stdout anymore
regrtest doesn't check that tests doesn't write something to stdout anymore.
Don't replace sys.stdout by the original sys.stdout to be able to capture the
output for regrtest -W.
-rw-r--r-- | Lib/test/support.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index a51d943de4..d4010f4832 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -1298,16 +1298,9 @@ def run_doctest(module, verbosity=None): else: verbosity = None - # Direct doctest output (normally just errors) to real stdout; doctest - # output shouldn't be compared by regrtest. - save_stdout = sys.stdout - sys.stdout = get_original_stdout() - try: - f, t = doctest.testmod(module, verbose=verbosity) - if f: - raise TestFailed("%d of %d doctests failed" % (f, t)) - finally: - sys.stdout = save_stdout + f, t = doctest.testmod(module, verbose=verbosity) + if f: + raise TestFailed("%d of %d doctests failed" % (f, t)) if verbose: print('doctest (%s) ... %d tests with zero failures' % (module.__name__, t)) |