mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
[3.11] gh-109748: Fix again venv test_zippath_from_non_installed_posix() (GH-110149) (#110153)
gh-109748: Fix again venv test_zippath_from_non_installed_posix() (GH-110149)
Call also copy_python_src_ignore() on listdir() names.
shutil.copytree(): replace set() with an empty tuple. An empty tuple
becomes a constant in the compiler and checking if an item is in an
empty tuple is cheap.
(cherry picked from commit 0def8c712b
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
cb1f49991e
commit
080f5b98d1
3 changed files with 7 additions and 3 deletions
|
@ -454,7 +454,7 @@ def _copytree(entries, src, dst, symlinks, ignore, copy_function,
|
||||||
if ignore is not None:
|
if ignore is not None:
|
||||||
ignored_names = ignore(os.fspath(src), [x.name for x in entries])
|
ignored_names = ignore(os.fspath(src), [x.name for x in entries])
|
||||||
else:
|
else:
|
||||||
ignored_names = set()
|
ignored_names = ()
|
||||||
|
|
||||||
os.makedirs(dst, exist_ok=dirs_exist_ok)
|
os.makedirs(dst, exist_ok=dirs_exist_ok)
|
||||||
errors = []
|
errors = []
|
||||||
|
|
|
@ -818,7 +818,7 @@ class TestSupport(unittest.TestCase):
|
||||||
self.assertEqual(support.copy_python_src_ignore(path, os.listdir(path)),
|
self.assertEqual(support.copy_python_src_ignore(path, os.listdir(path)),
|
||||||
ignored | {'build', 'venv'})
|
ignored | {'build', 'venv'})
|
||||||
|
|
||||||
# An other directory
|
# Another directory
|
||||||
path = os.path.join(src_dir, 'Objects')
|
path = os.path.join(src_dir, 'Objects')
|
||||||
self.assertEqual(support.copy_python_src_ignore(path, os.listdir(path)),
|
self.assertEqual(support.copy_python_src_ignore(path, os.listdir(path)),
|
||||||
ignored)
|
ignored)
|
||||||
|
|
|
@ -572,7 +572,11 @@ class BasicTest(BaseTest):
|
||||||
eachpath,
|
eachpath,
|
||||||
os.path.join(non_installed_dir, platlibdir))
|
os.path.join(non_installed_dir, platlibdir))
|
||||||
elif os.path.isfile(os.path.join(eachpath, "os.py")):
|
elif os.path.isfile(os.path.join(eachpath, "os.py")):
|
||||||
for name in os.listdir(eachpath):
|
names = os.listdir(eachpath)
|
||||||
|
ignored_names = copy_python_src_ignore(eachpath, names)
|
||||||
|
for name in names:
|
||||||
|
if name in ignored_names:
|
||||||
|
continue
|
||||||
if name == "site-packages":
|
if name == "site-packages":
|
||||||
continue
|
continue
|
||||||
fn = os.path.join(eachpath, name)
|
fn = os.path.join(eachpath, name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue