33import contextlib
44import pathlib
55import pickle
6- import string
76import sys
87import unittest
98import zipfile
1211from ._itertools import Counter
1312
1413from ._test_params import parameterize , Invoked
15- from ._func_timeout_compat import set_timeout
1614
1715from test .support .os_helper import temp_dir
1816
@@ -22,9 +20,6 @@ class itertools:
2220 Counter = Counter
2321
2422
25- consume = tuple
26-
27-
2823def add_dirs (zf ):
2924 """
3025 Given a writable zip file zf, inject directory entries for
@@ -330,12 +325,6 @@ def test_joinpath_constant_time(self):
330325 # Check the file iterated all items
331326 assert entries .count == self .HUGE_ZIPFILE_NUM_ENTRIES
332327
333- # timeout disabled due to #102209
334- # @set_timeout(3)
335- def test_implied_dirs_performance (self ):
336- data = ['/' .join (string .ascii_lowercase + str (n )) for n in range (10000 )]
337- zipfile .CompleteDirs ._implied_dirs (data )
338-
339328 @pass_alpharep
340329 def test_read_does_not_close (self , alpharep ):
341330 alpharep = self .zipfile_ondisk (alpharep )
@@ -513,7 +502,7 @@ def test_pickle(self, alpharep, path_type, subpath):
513502 saved_1 = pickle .dumps (zipfile .Path (zipfile_ondisk , at = subpath ))
514503 restored_1 = pickle .loads (saved_1 )
515504 first , * rest = restored_1 .iterdir ()
516- assert first .read_text ().startswith ('content of ' )
505+ assert first .read_text (encoding = 'utf-8' ).startswith ('content of ' )
517506
518507 @pass_alpharep
519508 def test_extract_orig_with_implied_dirs (self , alpharep ):
@@ -525,3 +514,12 @@ def test_extract_orig_with_implied_dirs(self, alpharep):
525514 # wrap the zipfile for its side effect
526515 zipfile .Path (zf )
527516 zf .extractall (source_path .parent )
517+
518+ @pass_alpharep
519+ def test_getinfo_missing (self , alpharep ):
520+ """
521+ Validate behavior of getinfo on original zipfile after wrapping.
522+ """
523+ zipfile .Path (alpharep )
524+ with self .assertRaises (KeyError ):
525+ alpharep .getinfo ('does-not-exist' )
0 commit comments