summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-02-25 10:55:19 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-02-25 10:55:19 (GMT)
commitee7fe38d401e20fed8d0cf5d02e9dc6a21fa2013 (patch)
tree641b8dd8ac72d4089a87904ac5e38bbeadcc6987 /Lib
parent7a7ad351b34e8147084e836b467fd44ac13829eb (diff)
downloadcpython-ee7fe38d401e20fed8d0cf5d02e9dc6a21fa2013.zip
cpython-ee7fe38d401e20fed8d0cf5d02e9dc6a21fa2013.tar.gz
cpython-ee7fe38d401e20fed8d0cf5d02e9dc6a21fa2013.tar.bz2
Issue #25801: Fixed resource warnings in test_zipfile64.
Patch by SilentGhost.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_zipfile64.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py
index a87baaa..151baf2 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: