FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.11] gh-89745: Avoid exact match when comparing program_name in test_embed on Windows (GH-93888) by miss-islington · Pull Request #93933 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
17 changes: 7 additions & 10 deletions Lib/test/test_embed.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def _get_expected_config(self):
return configs

def get_expected_config(self, expected_preconfig, expected,
env, api, modify_path_cb=None, cwd=None):
env, api, modify_path_cb=None):
configs = self._get_expected_config()

pre_config = configs['pre_config']
Expand Down Expand Up @@ -673,14 +673,6 @@ def get_expected_config(self, expected_preconfig, expected,
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():
Expand Down Expand Up @@ -710,6 +702,11 @@ def check_pre_config(self, configs, expected):

def check_config(self, configs, expected):
config = dict(configs['config'])
if MS_WINDOWS:
value = config.get(key := 'program_name')
if value and isinstance(value, str):
ext = '_d.exe' if debug_build(sys.executable) else '.exe'
config[key] = value[:len(value.lower().removesuffix(ext))]
for key, value in list(expected.items()):
if value is self.IGNORE_CONFIG:
config.pop(key, None)
Expand Down Expand Up @@ -774,7 +771,7 @@ def check_all_configs(self, testname, expected_config=None,
self.get_expected_config(expected_preconfig,
expected_config,
env,
api, modify_path_cb, cwd)
api, modify_path_cb)

out, err = self.run_embedded_interpreter(testname,
env=env, cwd=cwd)
Expand Down

Back | FazBrowse Home | New Git URL