[Python-checkins] cpython (merge 3.5 -> default): Issue #25801: Fixed resource warnings in test_zipfile64.

serhiy.storchaka python-checkins at python.org
Thu Feb 25 06:16:41 EST 2016


https://hg.python.org/cpython/rev/2193f8b956de
changeset:   100330:2193f8b956de
parent:      100327:cd69b81d231d
parent:      100328:baec3e2e1b1f
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Feb 25 13:16:02 2016 +0200
summary:
  Issue #25801: Fixed resource warnings in test_zipfile64.
Patch by SilentGhost.

files:
  Lib/test/test_zipfile64.py |  8 ++++++--
  1 files changed, 6 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py
--- a/Lib/test/test_zipfile64.py
+++ b/Lib/test/test_zipfile64.py
@@ -72,15 +72,19 @@
     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:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list