mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-40280: Address more test failures on Emscripten (GH-31050)
Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
parent
9d4161a60c
commit
96b344c2f1
27 changed files with 227 additions and 49 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue