diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index aa8c463dab7..67e85704aab 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -750,9 +750,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) diff --git a/Misc/NEWS b/Misc/NEWS index f7f14b722a9..9e007b45ad0 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -69,6 +69,9 @@ Library Tests ----- +- Issue #21520: test_zipfile no longer fails if the word 'bad' appears + anywhere in the name of the current directory. + - Issue #9517: Move script_helper into the support package. Patch by Christie Wilson.