summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorneonene <53406459+neonene@users.noreply.github.com>2021-12-06 17:25:19 (GMT)
committerGitHub <noreply@github.com>2021-12-06 17:25:19 (GMT)
commitaf1db4eb555e02d2bff3476f99f7a653764203b0 (patch)
tree1331d6690165176be0804ee4fa9e55d15d3875ed /Lib
parent612e59b53f0c730ce1b881f7c08dc6d49f02c123 (diff)
downloadcpython-af1db4eb555e02d2bff3476f99f7a653764203b0.zip
cpython-af1db4eb555e02d2bff3476f99f7a653764203b0.tar.gz
cpython-af1db4eb555e02d2bff3476f99f7a653764203b0.tar.bz2
bpo-45582: Fix getpath_isxfile() and test_embed on Windows (GH-29930)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_embed.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 3620a76..94161b6 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -575,7 +575,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
return configs
def get_expected_config(self, expected_preconfig, expected,
- env, api, modify_path_cb=None):
+ env, api, modify_path_cb=None, cwd=None):
configs = self._get_expected_config()
pre_config = configs['pre_config']
@@ -618,6 +618,14 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
expected['base_executable'] = default_executable
if expected['program_name'] is self.GET_DEFAULT_CONFIG:
expected['program_name'] = './_testembed'
+ if MS_WINDOWS:
+ # follow the calculation in getpath.py
+ tmpname = expected['program_name'] + '.exe'
+ if cwd:
+ tmpname = os.path.join(cwd, tmpname)
+ if os.path.isfile(tmpname):
+ expected['program_name'] += '.exe'
+ del tmpname
config = configs['config']
for key, value in expected.items():
@@ -711,7 +719,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
self.get_expected_config(expected_preconfig,
expected_config,
env,
- api, modify_path_cb)
+ api, modify_path_cb, cwd)
out, err = self.run_embedded_interpreter(testname,
env=env, cwd=cwd)