3
3
import contextlib
4
4
import pathlib
5
5
import pickle
6
- import string
7
6
import sys
8
7
import unittest
9
8
import zipfile
12
11
from ._itertools import Counter
13
12
14
13
from ._test_params import parameterize , Invoked
15
- from ._func_timeout_compat import set_timeout
16
14
17
15
from test .support .os_helper import temp_dir
18
16
@@ -22,9 +20,6 @@ class itertools:
22
20
Counter = Counter
23
21
24
22
25
- consume = tuple
26
-
27
-
28
23
def add_dirs (zf ):
29
24
"""
30
25
Given a writable zip file zf, inject directory entries for
@@ -330,12 +325,6 @@ def test_joinpath_constant_time(self):
330
325
# Check the file iterated all items
331
326
assert entries .count == self .HUGE_ZIPFILE_NUM_ENTRIES
332
327
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
-
339
328
@pass_alpharep
340
329
def test_read_does_not_close (self , alpharep ):
341
330
alpharep = self .zipfile_ondisk (alpharep )
@@ -513,7 +502,7 @@ def test_pickle(self, alpharep, path_type, subpath):
513
502
saved_1 = pickle .dumps (zipfile .Path (zipfile_ondisk , at = subpath ))
514
503
restored_1 = pickle .loads (saved_1 )
515
504
first , * rest = restored_1 .iterdir ()
516
- assert first .read_text ().startswith ('content of ' )
505
+ assert first .read_text (encoding = 'utf-8' ).startswith ('content of ' )
517
506
518
507
@pass_alpharep
519
508
def test_extract_orig_with_implied_dirs (self , alpharep ):
@@ -525,3 +514,12 @@ def test_extract_orig_with_implied_dirs(self, alpharep):
525
514
# wrap the zipfile for its side effect
526
515
zipfile .Path (zf )
527
516
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