gh-109748: Fix venv test_zippath_from_non_installed_posix() (#109872)

Fix test_zippath_from_non_installed_posix() of test_venv: don't copy
__pycache__/ sub-directories, because they can be modified by other
Python tests running in parallel.
This commit is contained in:
Victor Stinner 2023-09-26 01:16:30 +02:00 committed by GitHub
parent d73c12b88c
commit 25bb266fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -559,6 +559,13 @@ class BasicTest(BaseTest):
platlibdir,
stdlib_zip)
additional_pythonpath_for_non_installed = []
# gh-109748: Don't copy __pycache__/ sub-directories, because they can
# be modified by other Python tests running in parallel.
ignored_names = {'__pycache__'}
def ignore_pycache(src, names):
return ignored_names
# Copy stdlib files to the non-installed python so venv can
# correctly calculate the prefix.
for eachpath in sys.path:
@ -575,7 +582,8 @@ class BasicTest(BaseTest):
if os.path.isfile(fn):
shutil.copy(fn, libdir)
elif os.path.isdir(fn):
shutil.copytree(fn, os.path.join(libdir, name))
shutil.copytree(fn, os.path.join(libdir, name),
ignore=ignore_pycache)
else:
additional_pythonpath_for_non_installed.append(
eachpath)

View File

@ -0,0 +1,3 @@
Fix ``test_zippath_from_non_installed_posix()`` of test_venv: don't copy
``__pycache__/`` sub-directories, because they can be modified by other Python
tests running in parallel. Patch by Victor Stinner.