Skip to content

[3.11] gh-109748: Fix venv test_zippath_from_non_installed_posix() (GH-109872) #109874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Lib/test/test_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,13 @@ def test_zippath_from_non_installed_posix(self):
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:
Expand All @@ -578,7 +585,8 @@ def test_zippath_from_non_installed_posix(self):
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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.