mirror of
https://github.com/python/cpython.git
synced 2025-11-08 17:41:42 +00:00
gh-102209: Sync with zipp 3.15 moving complexity tests into dedicated module (#102232)
Sync with jaraco/zipp@757a4e1a.
This commit is contained in:
parent
207e1c5cae
commit
a35fd38b57
7 changed files with 87 additions and 51 deletions
|
|
@ -3,7 +3,6 @@
|
|||
import contextlib
|
||||
import pathlib
|
||||
import pickle
|
||||
import string
|
||||
import sys
|
||||
import unittest
|
||||
import zipfile
|
||||
|
|
@ -12,7 +11,6 @@
|
|||
from ._itertools import Counter
|
||||
|
||||
from ._test_params import parameterize, Invoked
|
||||
from ._func_timeout_compat import set_timeout
|
||||
|
||||
from test.support.os_helper import temp_dir
|
||||
|
||||
|
|
@ -22,9 +20,6 @@ class itertools:
|
|||
Counter = Counter
|
||||
|
||||
|
||||
consume = tuple
|
||||
|
||||
|
||||
def add_dirs(zf):
|
||||
"""
|
||||
Given a writable zip file zf, inject directory entries for
|
||||
|
|
@ -330,12 +325,6 @@ def test_joinpath_constant_time(self):
|
|||
# Check the file iterated all items
|
||||
assert entries.count == self.HUGE_ZIPFILE_NUM_ENTRIES
|
||||
|
||||
# timeout disabled due to #102209
|
||||
# @set_timeout(3)
|
||||
def test_implied_dirs_performance(self):
|
||||
data = ['/'.join(string.ascii_lowercase + str(n)) for n in range(10000)]
|
||||
zipfile.CompleteDirs._implied_dirs(data)
|
||||
|
||||
@pass_alpharep
|
||||
def test_read_does_not_close(self, alpharep):
|
||||
alpharep = self.zipfile_ondisk(alpharep)
|
||||
|
|
@ -513,7 +502,7 @@ def test_pickle(self, alpharep, path_type, subpath):
|
|||
saved_1 = pickle.dumps(zipfile.Path(zipfile_ondisk, at=subpath))
|
||||
restored_1 = pickle.loads(saved_1)
|
||||
first, *rest = restored_1.iterdir()
|
||||
assert first.read_text().startswith('content of ')
|
||||
assert first.read_text(encoding='utf-8').startswith('content of ')
|
||||
|
||||
@pass_alpharep
|
||||
def test_extract_orig_with_implied_dirs(self, alpharep):
|
||||
|
|
@ -525,3 +514,12 @@ def test_extract_orig_with_implied_dirs(self, alpharep):
|
|||
# wrap the zipfile for its side effect
|
||||
zipfile.Path(zf)
|
||||
zf.extractall(source_path.parent)
|
||||
|
||||
@pass_alpharep
|
||||
def test_getinfo_missing(self, alpharep):
|
||||
"""
|
||||
Validate behavior of getinfo on original zipfile after wrapping.
|
||||
"""
|
||||
zipfile.Path(alpharep)
|
||||
with self.assertRaises(KeyError):
|
||||
alpharep.getinfo('does-not-exist')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue