diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-02-25 12:55:19 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-02-25 12:55:19 +0200 |
commit | 15d0f4f6c7394449f5aa7958bdd234ea0644a6e8 (patch) | |
tree | 2eecb154907f2f88276f9e1ed366a9590a1b9492 | |
parent | 91f1c2916fa9a122e4e8f69a2b84825996bad575 (diff) | |
download | python-15d0f4f6c7394449f5aa7958bdd234ea0644a6e8.tar.gz |
Issue #25801: Fixed resource warnings in test_zipfile64.
Patch by SilentGhost.
-rw-r--r-- | Lib/test/test_zipfile64.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py index a87baaa899..151baf2302 100644 --- a/Lib/test/test_zipfile64.py +++ b/Lib/test/test_zipfile64.py @@ -79,15 +79,19 @@ class TestsWithSourceFile(unittest.TestCase): def testStored(self): # Try the temp file first. If we do TESTFN2 first, then it hogs # gigabytes of disk space for the duration of the test. - for f in TemporaryFile(), TESTFN2: + with TemporaryFile() as f: self.zipTest(f, zipfile.ZIP_STORED) + self.assertFalse(f.closed) + self.zipTest(TESTFN2, zipfile.ZIP_STORED) - if zlib: - def testDeflated(self): - # Try the temp file first. If we do TESTFN2 first, then it hogs - # gigabytes of disk space for the duration of the test. - for f in TemporaryFile(), TESTFN2: - self.zipTest(f, zipfile.ZIP_DEFLATED) + @unittest.skipUnless(zlib, "requires zlib") + def testDeflated(self): + # Try the temp file first. If we do TESTFN2 first, then it hogs + # gigabytes of disk space for the duration of the test. + with TemporaryFile() as f: + self.zipTest(f, zipfile.ZIP_DEFLATED) + self.assertFalse(f.closed) + self.zipTest(TESTFN2, zipfile.ZIP_DEFLATED) def tearDown(self): for fname in TESTFN, TESTFN2: |