Skip to content
Merged
Prev Previous commit
Next Next commit
Fix test_embed by creating expected paths instead of ignoring stderr
Signed-off-by: Filipe Laíns <lains@riseup.net>
  • Loading branch information
FFY00 committed Feb 27, 2026
commit 9cb1166493fc5b0116c5e96bc56becc2e98c2bc0
17 changes: 11 additions & 6 deletions Lib/test/test_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,10 @@ def test_init_setpythonhome(self):
stdlib = os.path.join(home, sys.platlibdir, f'python{version}{ABI_THREAD}')
expected_paths = self.module_search_paths(prefix=home, exec_prefix=home)

# Create the expected paths to avoid the bad stdlib dir warning
for entry in expected_paths:
os.makedirs(entry, exist_ok=True)

config = {
'home': home,
'module_search_paths': expected_paths,
Expand All @@ -1492,8 +1496,7 @@ def test_init_setpythonhome(self):
self.default_program_name(config)
env = {'TESTHOME': home, 'PYTHONPATH': paths_str}
self.check_all_configs("test_init_setpythonhome", config,
api=API_COMPAT, env=env,
ignore_stderr=True) # ignore missing stdlib warning
api=API_COMPAT, env=env)

def test_init_is_python_build_with_home(self):
# Test _Py_path_config._is_python_build configuration (gh-91985)
Expand Down Expand Up @@ -1521,6 +1524,10 @@ def test_init_is_python_build_with_home(self):
stdlib = os.path.join(home, sys.platlibdir, f'python{version}{ABI_THREAD}')
expected_paths = self.module_search_paths(prefix=home, exec_prefix=home)

# Create the expected paths to avoid the bad stdlib dir warning
for entry in expected_paths:
os.makedirs(entry, exist_ok=True)

config = {
'home': home,
'module_search_paths': expected_paths,
Expand All @@ -1537,8 +1544,7 @@ def test_init_is_python_build_with_home(self):
env['NEGATIVE_ISPYTHONBUILD'] = '1'
config['_is_python_build'] = 0
self.check_all_configs("test_init_is_python_build", config,
api=API_COMPAT, env=env,
ignore_stderr=True) # ignore missing stdlib warning
api=API_COMPAT, env=env)

env['NEGATIVE_ISPYTHONBUILD'] = '0'
config['_is_python_build'] = 1
Expand All @@ -1554,8 +1560,7 @@ def test_init_is_python_build_with_home(self):
config.update(prefix=prefix, base_prefix=prefix,
exec_prefix=exec_prefix, base_exec_prefix=exec_prefix)
self.check_all_configs("test_init_is_python_build", config,
api=API_COMPAT, env=env,
ignore_stderr=True) # ignore missing stdlib warning
api=API_COMPAT, env=env)

def copy_paths_by_env(self, config):
all_configs = self._get_expected_config()
Expand Down
Loading