diff options
| author | Georg Brandl <georg@python.org> | 2013-10-21 06:29:29 (GMT) |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2013-10-21 06:29:29 (GMT) |
| commit | a606542e95f6de9880a2554c7ae0a4d6b02e742b (patch) | |
| tree | bcae559d7d456313b806b7b84848d782c37d8694 /Lib/test/test_zipfile.py | |
| parent | b0c84cdaac987e075099ac65a218505e9efbdda3 (diff) | |
| download | cpython-a606542e95f6de9880a2554c7ae0a4d6b02e742b.zip cpython-a606542e95f6de9880a2554c7ae0a4d6b02e742b.tar.gz cpython-a606542e95f6de9880a2554c7ae0a4d6b02e742b.tar.bz2 | |
#19274: use captured_stdout() in the test suite; add NEWS entry.
Diffstat (limited to 'Lib/test/test_zipfile.py')
| -rw-r--r-- | Lib/test/test_zipfile.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 4a8c1af..f57da5f 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -597,22 +597,19 @@ class PyZipFileTests(unittest.TestCase): with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp: - stdout = sys.stdout - # first make sure that the test folder gives error messages - sys.stdout = reportSIO = io.StringIO() - zipfp.writepy(packagedir) + # (on the badsyntax_... files) + with captured_stdout() as reportSIO: + zipfp.writepy(packagedir) reportStr = reportSIO.getvalue() self.assertTrue('SyntaxError' in reportStr) # then check that the filter works - sys.stdout = reportSIO = io.StringIO() - zipfp.writepy(packagedir, filterfunc=lambda whatever:False) + with captured_stdout() as reportSIO: + zipfp.writepy(packagedir, filterfunc=lambda whatever: False) reportStr = reportSIO.getvalue() self.assertTrue('SyntaxError' not in reportStr) - sys.stdout = stdout - def test_write_with_optimization(self): import email packagedir = os.path.dirname(email.__file__) |
