diff options
author | Steve Dower <steve.dower@python.org> | 2022-01-18 15:46:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 15:46:26 +0000 |
commit | 7407fe4c25ba0308d49e3e88e4a107ef32251cdc (patch) | |
tree | 38712e77d784e1beb2e1e5bf19d39db596ef6c0f /Lib/test/test_getpath.py | |
parent | 32398294fb3fcf4ee74da54722fd0221c4e6cb74 (diff) | |
download | cpython-7407fe4c25ba0308d49e3e88e4a107ef32251cdc.tar.gz cpython-7407fe4c25ba0308d49e3e88e4a107ef32251cdc.zip |
bpo-46028: Calculate base_executable by resolving symlinks in a venv (GH-30144)
Diffstat (limited to 'Lib/test/test_getpath.py')
-rw-r--r-- | Lib/test/test_getpath.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Lib/test/test_getpath.py b/Lib/test/test_getpath.py index 1a336a4abca..eaf4a992796 100644 --- a/Lib/test/test_getpath.py +++ b/Lib/test/test_getpath.py @@ -328,6 +328,38 @@ class MockGetPathTests(unittest.TestCase): actual = getpath(ns, expected) self.assertEqual(expected, actual) + def test_venv_changed_name_posix(self): + "Test a venv layout on *nix." + ns = MockPosixNamespace( + argv0="python", + PREFIX="/usr", + ENV_PATH="/venv/bin:/usr/bin", + ) + ns.add_known_xfile("/usr/bin/python3") + ns.add_known_xfile("/venv/bin/python") + ns.add_known_link("/venv/bin/python", "/usr/bin/python3") + ns.add_known_file("/usr/lib/python9.8/os.py") + ns.add_known_dir("/usr/lib/python9.8/lib-dynload") + ns.add_known_file("/venv/pyvenv.cfg", [ + r"home = /usr/bin" + ]) + expected = dict( + executable="/venv/bin/python", + prefix="/usr", + exec_prefix="/usr", + base_executable="/usr/bin/python3", + base_prefix="/usr", + base_exec_prefix="/usr", + module_search_paths_set=1, + module_search_paths=[ + "/usr/lib/python98.zip", + "/usr/lib/python9.8", + "/usr/lib/python9.8/lib-dynload", + ], + ) + actual = getpath(ns, expected) + self.assertEqual(expected, actual) + def test_symlink_normal_posix(self): "Test a 'standard' install layout via symlink on *nix" ns = MockPosixNamespace( |