diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/autotest.py | 13 |
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() |