Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f828218

Browse files
Issue #25801: Fixed resource warnings in test_zipfile64.
Patch by SilentGhost.
1 parent e76a6d5 commit f828218

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/test/test_zipfile64.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,19 @@ def zipTest(self, f, compression):
7272
def testStored(self):
7373
# Try the temp file first. If we do TESTFN2 first, then it hogs
7474
# gigabytes of disk space for the duration of the test.
75-
for f in TemporaryFile(), TESTFN2:
75+
with TemporaryFile() as f:
7676
self.zipTest(f, zipfile.ZIP_STORED)
77+
self.assertFalse(f.closed)
78+
self.zipTest(TESTFN2, zipfile.ZIP_STORED)
7779

7880
@requires_zlib
7981
def testDeflated(self):
8082
# Try the temp file first. If we do TESTFN2 first, then it hogs
8183
# gigabytes of disk space for the duration of the test.
82-
for f in TemporaryFile(), TESTFN2:
84+
with TemporaryFile() as f:
8385
self.zipTest(f, zipfile.ZIP_DEFLATED)
86+
self.assertFalse(f.closed)
87+
self.zipTest(TESTFN2, zipfile.ZIP_DEFLATED)
8488

8589
def tearDown(self):
8690
for fname in TESTFN, TESTFN2:

0 commit comments

Comments
 (0)