Skip to content

Commit cd613ed

Browse files
Update the zipfile + zipimport libraries + tests - v3.13.11 (#6639)
* Updated zipimport library + test * Updated zipfile library + test * Annotated failing/erroring tests in test_zipfile and test_zipimport * Changed all skips in `test_core.py` to expectedFailures * skip EncodedMetadataTests --------- Co-authored-by: Jeong YunWon <jeong@youknowone.org>
1 parent e367145 commit cd613ed

File tree

8 files changed

+675
-409
lines changed

8 files changed

+675
-409
lines changed

Lib/test/test_zipfile/_path/test_path.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ def test_pathlike_construction(self, alpharep):
275275
"""
276276
zipfile_ondisk = self.zipfile_ondisk(alpharep)
277277
pathlike = FakePath(str(zipfile_ondisk))
278-
zipfile.Path(pathlike)
278+
root = zipfile.Path(pathlike)
279+
root.root.close()
279280

280281
@pass_alpharep
281282
def test_traverse_pathlike(self, alpharep):
@@ -374,6 +375,7 @@ def test_root_on_disk(self, alpharep):
374375
root = zipfile.Path(self.zipfile_ondisk(alpharep))
375376
assert root.name == 'alpharep.zip' == root.filename.name
376377
assert root.stem == 'alpharep' == root.filename.stem
378+
root.root.close()
377379

378380
@pass_alpharep
379381
def test_suffix(self, alpharep):
@@ -565,7 +567,7 @@ def test_inheritance(self, alpharep):
565567
file = cls(alpharep).joinpath('some dir').parent
566568
assert isinstance(file, cls)
567569

568-
@unittest.skipIf(sys.platform == 'win32', "TODO: RUSTPYTHON, fails on Windows")
570+
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON; fails on Windows')
569571
@parameterize(
570572
['alpharep', 'path_type', 'subpath'],
571573
itertools.product(
@@ -576,11 +578,13 @@ def test_inheritance(self, alpharep):
576578
)
577579
def test_pickle(self, alpharep, path_type, subpath):
578580
zipfile_ondisk = path_type(str(self.zipfile_ondisk(alpharep)))
579-
580-
saved_1 = pickle.dumps(zipfile.Path(zipfile_ondisk, at=subpath))
581+
root = zipfile.Path(zipfile_ondisk, at=subpath)
582+
saved_1 = pickle.dumps(root)
583+
root.root.close()
581584
restored_1 = pickle.loads(saved_1)
582585
first, *rest = restored_1.iterdir()
583586
assert first.read_text(encoding='utf-8').startswith('content of ')
587+
restored_1.root.close()
584588

585589
@pass_alpharep
586590
def test_extract_orig_with_implied_dirs(self, alpharep):
@@ -592,6 +596,7 @@ def test_extract_orig_with_implied_dirs(self, alpharep):
592596
# wrap the zipfile for its side effect
593597
zipfile.Path(zf)
594598
zf.extractall(source_path.parent)
599+
zf.close()
595600

596601
@pass_alpharep
597602
def test_getinfo_missing(self, alpharep):

Lib/test/test_zipfile/test_core.py

Lines changed: 113 additions & 39 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)