summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-02-25 12:55:19 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-02-25 12:55:19 +0200
commitf828218d652fe8120d88cfefa52df5c2039cdf92 (patch)
treeca70c058ab7a6e8ea0cf49cae166a6c40b89cdaa
parente76a6d56d222bf2c103c388b2be991eec88ab44e (diff)
downloadcpython-git-f828218d652fe8120d88cfefa52df5c2039cdf92.tar.gz
Issue #25801: Fixed resource warnings in test_zipfile64.
Patch by SilentGhost.
-rw-r--r--Lib/test/test_zipfile64.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py
index b9e8e28667..c29bd8d2ec 100644
--- a/Lib/test/test_zipfile64.py
+++ b/Lib/test/test_zipfile64.py
@@ -72,15 +72,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)
@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.
- for f in TemporaryFile(), TESTFN2:
+ 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: