summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r--Lib/test/test_zipfile.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index e226dd7..de2dd33 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -22,7 +22,9 @@ from random import randint, random, randbytes
from test.support import script_helper
from test.support import (findfile, requires_zlib, requires_bz2,
requires_lzma, captured_stdout, requires_subprocess)
-from test.support.os_helper import TESTFN, unlink, rmtree, temp_dir, temp_cwd
+from test.support.os_helper import (
+ TESTFN, unlink, rmtree, temp_dir, temp_cwd, fd_count
+)
TESTFN2 = TESTFN + "2"
@@ -2539,14 +2541,14 @@ class TestsWithMultipleOpens(unittest.TestCase):
def test_many_opens(self):
# Verify that read() and open() promptly close the file descriptor,
# and don't rely on the garbage collector to free resources.
+ startcount = fd_count()
self.make_test_archive(TESTFN2)
with zipfile.ZipFile(TESTFN2, mode="r") as zipf:
for x in range(100):
zipf.read('ones')
with zipf.open('ones') as zopen1:
pass
- with open(os.devnull, "rb") as f:
- self.assertLess(f.fileno(), 100)
+ self.assertEqual(startcount, fd_count())
def test_write_while_reading(self):
with zipfile.ZipFile(TESTFN2, 'w', zipfile.ZIP_DEFLATED) as zipf: