Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a606542

Browse files
committed
#19274: use captured_stdout() in the test suite; add NEWS entry.
1 parent b0c84cd commit a606542

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

Doc/library/zipfile.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,6 @@ The :class:`PyZipFile` constructor takes the same parameters as the
384384

385385
.. method:: PyZipFile.writepy(pathname, basename='', filterfunc=None)
386386

387-
.. versionadded:: 3.4
388-
The *filterfunc* parameter.
389-
390387
Search for files :file:`\*.py` and add the corresponding file to the
391388
archive.
392389

@@ -419,6 +416,9 @@ The :class:`PyZipFile` constructor takes the same parameters as the
419416
test/bogus/__init__.pyc # Subpackage directory
420417
test/bogus/myfile.pyc # Submodule test.bogus.myfile
421418

419+
.. versionadded:: 3.4
420+
The *filterfunc* parameter.
421+
422422

423423
.. _zipinfo-objects:
424424

Lib/test/test_zipfile.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -597,22 +597,19 @@ def test_write_filtered_python_package(self):
597597

598598
with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
599599

600-
stdout = sys.stdout
601-
602600
# first make sure that the test folder gives error messages
603-
sys.stdout = reportSIO = io.StringIO()
604-
zipfp.writepy(packagedir)
601+
# (on the badsyntax_... files)
602+
with captured_stdout() as reportSIO:
603+
zipfp.writepy(packagedir)
605604
reportStr = reportSIO.getvalue()
606605
self.assertTrue('SyntaxError' in reportStr)
607606

608607
# then check that the filter works
609-
sys.stdout = reportSIO = io.StringIO()
610-
zipfp.writepy(packagedir, filterfunc=lambda whatever:False)
608+
with captured_stdout() as reportSIO:
609+
zipfp.writepy(packagedir, filterfunc=lambda whatever: False)
611610
reportStr = reportSIO.getvalue()
612611
self.assertTrue('SyntaxError' not in reportStr)
613612

614-
sys.stdout = stdout
615-
616613
def test_write_with_optimization(self):
617614
import email
618615
packagedir = os.path.dirname(email.__file__)

Misc/NEWS

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ Projected release date: 2013-11-24
1010
Core and Builtins
1111
-----------------
1212

13-
- Issue 19306: Add extra hints to the faulthandler module's stack
13+
- Issue #19306: Add extra hints to the faulthandler module's stack
1414
dumps that these are "upside down".
1515

16+
Library
17+
-------
18+
19+
- Issue #19274: Add a filterfunc parameter to PyZipFile.writepy.
20+
21+
1622
What's New in Python 3.4.0 Alpha 4?
1723
===================================
1824

0 commit comments

Comments
 (0)