diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-25 23:16:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-25 23:16:30 (GMT) |
commit | 25bb266fc876b344e31e0b5634a4db94912c1aba (patch) | |
tree | 9639d82a793303c9c0c59de55f5e0e0f9983d8f8 | |
parent | d73c12b88c2275fd44e27c91c24f3ac85419d2b8 (diff) | |
download | cpython-25bb266fc876b344e31e0b5634a4db94912c1aba.zip cpython-25bb266fc876b344e31e0b5634a4db94912c1aba.tar.gz cpython-25bb266fc876b344e31e0b5634a4db94912c1aba.tar.bz2 |
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.
-rw-r--r-- | Lib/test/test_venv.py | 10 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tests/2023-09-26-00-49-18.gh-issue-109748.nxlT1i.rst | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py index a894bb1..eb83aa3 100644 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -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) diff --git a/Misc/NEWS.d/next/Tests/2023-09-26-00-49-18.gh-issue-109748.nxlT1i.rst b/Misc/NEWS.d/next/Tests/2023-09-26-00-49-18.gh-issue-109748.nxlT1i.rst new file mode 100644 index 0000000..840366b --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2023-09-26-00-49-18.gh-issue-109748.nxlT1i.rst @@ -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. |