bpo-43218: Prevent venv creation when the target directory contains a PATH separator. (GH-24530)

This commit is contained in:
Dustin Rodrigues 2022-04-13 04:07:10 -04:00 committed by GitHub
parent 15537c51c1
commit 54f67ad543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -467,6 +467,14 @@ class BasicTest(BaseTest):
'import os; print("__PYVENV_LAUNCHER__" in os.environ)'])
self.assertEqual(out.strip(), 'False'.encode())
def test_pathsep_error(self):
"""
Test that venv creation fails when the target directory contains
the path separator.
"""
rmtree(self.env_dir)
self.assertRaises(ValueError, venv.create, self.env_dir + os.pathsep)
@requireVenvCreate
class EnsurePipTest(BaseTest):
"""Test venv module installation of pip."""