]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #12400: test.support.run_doctest() doesn't change sys.stdout anymore
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 29 Jun 2011 13:52:46 +0000 (15:52 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 29 Jun 2011 13:52:46 +0000 (15:52 +0200)
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.

Lib/test/support.py

index 25aab2e5afb603e9f81d3b80eb302315bded0bf0..83ea6c1bf0fc7c7951fff2653939aa7fdc75f0c3 100644 (file)
@@ -1230,16 +1230,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))