summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2015-05-08 13:54:58 (GMT)
committerLarry Hastings <larry@hastings.org>2015-05-08 13:54:58 (GMT)
commit7e63b36f7f6975b3d7590fc1c12caf04c39b2e7e (patch)
tree8f087cae2ef6c99507cf08c5903ab1fc92f1e026 /Lib/test/test_zipfile.py
parentb79e01248dceb398590b30532fca1a75727ce763 (diff)
downloadcpython-7e63b36f7f6975b3d7590fc1c12caf04c39b2e7e.zip
cpython-7e63b36f7f6975b3d7590fc1c12caf04c39b2e7e.tar.gz
cpython-7e63b36f7f6975b3d7590fc1c12caf04c39b2e7e.tar.bz2
Issue #21520: test_zipfile no longer fails if the word 'bad' appears
anywhere in the name of the current directory.
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r--Lib/test/test_zipfile.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 3d8f9bc..0c4c579 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -719,9 +719,10 @@ class PyZipFileTests(unittest.TestCase):
self.assertTrue('SyntaxError' not in reportStr)
# then check that the filter works on individual files
+ def filter(path):
+ return not os.path.basename(path).startswith("bad")
with captured_stdout() as reportSIO, self.assertWarns(UserWarning):
- zipfp.writepy(packagedir, filterfunc=lambda fn:
- 'bad' not in fn)
+ zipfp.writepy(packagedir, filterfunc=filter)
reportStr = reportSIO.getvalue()
if reportStr:
print(reportStr)