[Python-checkins] cpython: #19274: use captured_stdout() in the test suite; add NEWS entry.
georg.brandl
python-checkins at python.org
Mon Oct 21 08:41:58 CEST 2013
http://hg.python.org/cpython/rev/2d39b3555951
changeset: 86540:2d39b3555951
user: Georg Brandl <georg at python.org>
date: Mon Oct 21 08:29:29 2013 +0200
summary:
#19274: use captured_stdout() in the test suite; add NEWS entry.
files:
Doc/library/zipfile.rst | 6 +++---
Lib/test/test_zipfile.py | 13 +++++--------
Misc/NEWS | 8 +++++++-
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -384,9 +384,6 @@
.. 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 @@
test/bogus/__init__.pyc # Subpackage directory
test/bogus/myfile.pyc # Submodule test.bogus.myfile
+ .. versionadded:: 3.4
+ The *filterfunc* parameter.
+
.. _zipinfo-objects:
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -597,22 +597,19 @@
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__)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,9 +10,15 @@
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?
===================================
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list