bpo-45337: Use the realpath of the new executable when creating a venv on Windows (GH-28663)

(cherry picked from commit 6811fdaec8)

Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
Miss Islington (bot) 2021-10-07 15:55:05 -07:00 committed by GitHub
parent 86bf45e69e
commit eabca6e593
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 9 deletions

View file

@ -150,14 +150,20 @@ class BasicTest(BaseTest):
def test_upgrade_dependencies(self):
builder = venv.EnvBuilder()
bin_path = 'Scripts' if sys.platform == 'win32' else 'bin'
python_exe = 'python.exe' if sys.platform == 'win32' else 'python'
python_exe = os.path.split(sys.executable)[1]
with tempfile.TemporaryDirectory() as fake_env_dir:
expect_exe = os.path.normcase(
os.path.join(fake_env_dir, bin_path, python_exe)
)
if sys.platform == 'win32':
expect_exe = os.path.normcase(os.path.realpath(expect_exe))
def pip_cmd_checker(cmd):
cmd[0] = os.path.normcase(cmd[0])
self.assertEqual(
cmd,
[
os.path.join(fake_env_dir, bin_path, python_exe),
expect_exe,
'-m',
'pip',
'install',