mirror of
https://github.com/python/cpython.git
synced 2025-07-25 12:14:38 +00:00
Issue #25801: Fixed resource warnings in test_zipfile64.
Patch by SilentGhost.
This commit is contained in:
parent
e76a6d56d2
commit
f828218d65
1 changed files with 6 additions and 2 deletions
|
@ -72,15 +72,19 @@ class TestsWithSourceFile(unittest.TestCase):
|
||||||
def testStored(self):
|
def testStored(self):
|
||||||
# Try the temp file first. If we do TESTFN2 first, then it hogs
|
# Try the temp file first. If we do TESTFN2 first, then it hogs
|
||||||
# gigabytes of disk space for the duration of the test.
|
# 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.zipTest(f, zipfile.ZIP_STORED)
|
||||||
|
self.assertFalse(f.closed)
|
||||||
|
self.zipTest(TESTFN2, zipfile.ZIP_STORED)
|
||||||
|
|
||||||
@requires_zlib
|
@requires_zlib
|
||||||
def testDeflated(self):
|
def testDeflated(self):
|
||||||
# Try the temp file first. If we do TESTFN2 first, then it hogs
|
# Try the temp file first. If we do TESTFN2 first, then it hogs
|
||||||
# gigabytes of disk space for the duration of the test.
|
# 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.zipTest(f, zipfile.ZIP_DEFLATED)
|
||||||
|
self.assertFalse(f.closed)
|
||||||
|
self.zipTest(TESTFN2, zipfile.ZIP_DEFLATED)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
for fname in TESTFN, TESTFN2:
|
for fname in TESTFN, TESTFN2:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue