cpython (3.2): Issue #12400: test.support.run_doctest() doesn't change sys.stdout anymore

http://hg.python.org/cpython/rev/d8ba59de860a changeset: 71072:d8ba59de860a branch: 3.2 parent: 71070:2d07b1b4466a user: Victor Stinner <victor.stinner@haypocalc.com> date: Wed Jun 29 15:52:46 2011 +0200 summary: 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. files: Lib/test/support.py | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -1230,16 +1230,9 @@ 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)) -- Repository URL: http://hg.python.org/cpython
participants (1)
-
victor.stinner