summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipimport_support.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 16:12:33 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 16:12:33 (GMT)
commite6db1440d8975f89e821dd656c5399e11ee288b5 (patch)
treedad74662c46f444c9c34e85345a9f5f6dc7ddef0 /Lib/test/test_zipimport_support.py
parentfa832dea2aaea40c78780a3f7ece48ddf7ddc51a (diff)
parent592f679dce01dce70f1f917270e84e09c92ff337 (diff)
downloadcpython-e6db1440d8975f89e821dd656c5399e11ee288b5.zip
cpython-e6db1440d8975f89e821dd656c5399e11ee288b5.tar.gz
cpython-e6db1440d8975f89e821dd656c5399e11ee288b5.tar.bz2
(merge 3.2) Issue #12400: test_zipimport_support doesn't restore original
sys.stdout anymore regrtest doesn't check that a test doesn't output anything anymore.
Diffstat (limited to 'Lib/test/test_zipimport_support.py')
-rw-r--r--Lib/test/test_zipimport_support.py31
1 files changed, 12 insertions, 19 deletions
diff --git a/Lib/test/test_zipimport_support.py b/Lib/test/test_zipimport_support.py
index f0e2fbc..0c93a8c 100644
--- a/Lib/test/test_zipimport_support.py
+++ b/Lib/test/test_zipimport_support.py
@@ -33,26 +33,19 @@ from test import test_doctest, sample_doctest
def _run_object_doctest(obj, module):
- # Direct doctest output (normally just errors) to real stdout; doctest
- # output shouldn't be compared by regrtest.
- save_stdout = sys.stdout
- sys.stdout = test.support.get_original_stdout()
+ finder = doctest.DocTestFinder(verbose=verbose, recurse=False)
+ runner = doctest.DocTestRunner(verbose=verbose)
+ # Use the object's fully qualified name if it has one
+ # Otherwise, use the module's name
try:
- finder = doctest.DocTestFinder(verbose=verbose, recurse=False)
- runner = doctest.DocTestRunner(verbose=verbose)
- # Use the object's fully qualified name if it has one
- # Otherwise, use the module's name
- try:
- name = "%s.%s" % (obj.__module__, obj.__name__)
- except AttributeError:
- name = module.__name__
- for example in finder.find(obj, name, module):
- runner.run(example)
- f, t = runner.failures, runner.tries
- if f:
- raise test.support.TestFailed("%d of %d doctests failed" % (f, t))
- finally:
- sys.stdout = save_stdout
+ name = "%s.%s" % (obj.__module__, obj.__name__)
+ except AttributeError:
+ name = module.__name__
+ for example in finder.find(obj, name, module):
+ runner.run(example)
+ f, t = runner.failures, runner.tries
+ if f:
+ raise test.support.TestFailed("%d of %d doctests failed" % (f, t))
if verbose:
print ('doctest (%s) ... %d tests with zero failures' % (module.__name__, t))
return f, t