diff options
author | Steve Dower <steve.dower@python.org> | 2023-12-13 23:41:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-13 23:41:43 (GMT) |
commit | fddc829236d7b29a522a2160e57b2d7ca23b9b95 (patch) | |
tree | aaad0e053b6b2df28cbb56ce58138ffef6f6c41e /Lib/test/test_venv.py | |
parent | 41c18aacc7a6082fbd9b08697c4d6180a9b62265 (diff) | |
download | cpython-fddc829236d7b29a522a2160e57b2d7ca23b9b95.zip cpython-fddc829236d7b29a522a2160e57b2d7ca23b9b95.tar.gz cpython-fddc829236d7b29a522a2160e57b2d7ca23b9b95.tar.bz2 |
gh-86179: Implement realpath() on Windows for getpath.py calculations (GH-113033)
Diffstat (limited to 'Lib/test/test_venv.py')
-rw-r--r-- | Lib/test/test_venv.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py index 617d14d..8ecb23f 100644 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -46,7 +46,8 @@ if is_emscripten or is_wasi: def check_output(cmd, encoding=None): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + env={**os.environ, "PYTHONHOME": ""}) out, err = p.communicate() if p.returncode: if verbose and err: @@ -287,6 +288,16 @@ class BasicTest(BaseTest): cmd[2] = 'import sysconfig; print(sysconfig.%s)' % call out, err = check_output(cmd, encoding='utf-8') self.assertEqual(out.strip(), expected, err) + for attr, expected in ( + ('executable', self.envpy()), + # Usually compare to sys.executable, but if we're running in our own + # venv then we really need to compare to our base executable + ('_base_executable', sys._base_executable), + ): + with self.subTest(attr): + cmd[2] = f'import sys; print(sys.{attr})' + out, err = check_output(cmd, encoding='utf-8') + self.assertEqual(out.strip(), expected, err) @requireVenvCreate @unittest.skipUnless(can_symlink(), 'Needs symlinks') @@ -309,6 +320,16 @@ class BasicTest(BaseTest): cmd[2] = 'import sysconfig; print(sysconfig.%s)' % call out, err = check_output(cmd, encoding='utf-8') self.assertEqual(out.strip(), expected, err) + for attr, expected in ( + ('executable', self.envpy()), + # Usually compare to sys.executable, but if we're running in our own + # venv then we really need to compare to our base executable + ('_base_executable', sys._base_executable), + ): + with self.subTest(attr): + cmd[2] = f'import sys; print(sys.{attr})' + out, err = check_output(cmd, encoding='utf-8') + self.assertEqual(out.strip(), expected, err) if sys.platform == 'win32': ENV_SUBDIRS = ( |