summaryrefslogtreecommitdiffstats
path: root/Lib/test/autotest.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-12-11 16:54:54 (GMT)
committerGuido van Rossum <guido@python.org>1996-12-11 16:54:54 (GMT)
commitdbfed710a151f3f033cd3fc8be4fb9fd9c04a6c7 (patch)
treead8ea528c64d41203f689d3b55b89311f70b9e73 /Lib/test/autotest.py
parent50c5cf132a895ff6d10f081f7404ff2045e7948a (diff)
downloadcpython-dbfed710a151f3f033cd3fc8be4fb9fd9c04a6c7.zip
cpython-dbfed710a151f3f033cd3fc8be4fb9fd9c04a6c7.tar.gz
cpython-dbfed710a151f3f033cd3fc8be4fb9fd9c04a6c7.tar.bz2
Be more careful with the shuffling of stdout.
Diffstat (limited to 'Lib/test/autotest.py')
-rw-r--r--Lib/test/autotest.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/autotest.py b/Lib/test/autotest.py
index 4b15c26..aadd170 100644
--- a/Lib/test/autotest.py
+++ b/Lib/test/autotest.py
@@ -89,12 +89,13 @@ def usage(status):
def do_one_test(t, outdir):
filename = os.path.join(outdir, t)
real_stdout = sys.stdout
+ if generate:
+ print 'Generating:', filename
+ fake_stdout = open(filename, 'w')
+ else:
+ fake_stdout = Compare(filename)
try:
- if generate:
- print 'Generating:', filename
- sys.stdout = open(filename, 'w')
- else:
- sys.stdout = Compare(filename)
+ sys.stdout = fake_stdout
print t
unload(t)
try:
@@ -104,8 +105,8 @@ def do_one_test(t, outdir):
sys.stderr.write(msg+': Un-installed'
' optional module?\n')
finally:
- sys.stdout.close()
sys.stdout = real_stdout
+ fake_stdout.close()