]> granicus.if.org Git - python/commitdiff
#19274: use captured_stdout() in the test suite; add NEWS entry.
authorGeorg Brandl <georg@python.org>
Mon, 21 Oct 2013 06:29:29 +0000 (08:29 +0200)
committerGeorg Brandl <georg@python.org>
Mon, 21 Oct 2013 06:29:29 +0000 (08:29 +0200)
Doc/library/zipfile.rst
Lib/test/test_zipfile.py
Misc/NEWS

index 3ca20de1e44078ced66ffb79be3a73c3949e3ee1..f7303ea3f0a0313bf98852348840ddab68a6dbf5 100644 (file)
@@ -384,9 +384,6 @@ The :class:`PyZipFile` constructor takes the same parameters as the
 
    .. method:: PyZipFile.writepy(pathname, basename='', filterfunc=None)
 
-      .. versionadded:: 3.4
-         The *filterfunc* parameter.
-
       Search for files :file:`\*.py` and add the corresponding file to the
       archive.
 
@@ -419,6 +416,9 @@ The :class:`PyZipFile` constructor takes the same parameters as the
          test/bogus/__init__.pyc      # Subpackage directory
          test/bogus/myfile.pyc        # Submodule test.bogus.myfile
 
+      .. versionadded:: 3.4
+         The *filterfunc* parameter.
+
 
 .. _zipinfo-objects:
 
index 4a8c1af458de2f52aae96fe45c65366699b81cc7..f57da5f94d1ba0927c12b3456dd3d8e2445551ba 100644 (file)
@@ -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__)
index 379dfd70a5da3620104afe9c969a62b11011962e..c345bd05c4d903b2cc4136960396adcdbd6beb38 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,9 +10,15 @@ Projected release date: 2013-11-24
 Core and Builtins
 -----------------
 
-- Issue 19306: Add extra hints to the faulthandler module's stack
+- Issue #19306: Add extra hints to the faulthandler module's stack
   dumps that these are "upside down".
 
+Library
+-------
+
+- Issue #19274: Add a filterfunc parameter to PyZipFile.writepy.
+
+
 What's New in Python 3.4.0 Alpha 4?
 ===================================