]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #21520: test_zipfile no longer fails if the word 'bad' appears
authorLarry Hastings <larry@hastings.org>
Fri, 8 May 2015 13:54:58 +0000 (06:54 -0700)
committerLarry Hastings <larry@hastings.org>
Fri, 8 May 2015 13:54:58 +0000 (06:54 -0700)
anywhere in the name of the current directory.

Lib/test/test_zipfile.py
Misc/NEWS

index 3d8f9bc9c7bf925d811d08b8287578e266386ab8..0c4c5791c480c943444a958ece096fd1ac11aa5f 100644 (file)
@@ -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)
index 333aa43d889f0f16d8279f48c1627d69fe6a723d..79c705cd5b8c23b7ad59e11fab786b73d95740cd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -228,6 +228,9 @@ Library
 Tests
 -----
 
+- Issue #21520: test_zipfile no longer fails if the word 'bad' appears
+  anywhere in the name of the current directory.
+
 - Issue #23799: Added test.support.start_threads() for running and
   cleaning up multiple threads.