Skip to content

bpo-45506: Fix test_embed expecting to not find stdlib in source tree build when stdlib has been installed #29649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Lib/test/test_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
MAX_HASH_SEED = 4294967295


# If we are running from a build dir, but the stdlib has been installed,
# some tests need to expect different results.
STDLIB_INSTALL = os.path.join(sys.prefix, sys.platlibdir,
f'python{sys.version_info.major}.{sys.version_info.minor}')
if not os.path.isfile(os.path.join(STDLIB_INSTALL, 'os.py')):
STDLIB_INSTALL = None

def debug_build(program):
program = os.path.basename(program)
name = os.path.splitext(program)[0]
Expand Down Expand Up @@ -1307,10 +1314,8 @@ def test_init_pybuilddir(self):
'base_executable': executable,
'executable': executable,
'module_search_paths': module_search_paths,
# The current getpath.c doesn't determine the stdlib dir
# in this case.
'stdlib_dir': None,
'use_frozen_modules': -1,
'stdlib_dir': STDLIB_INSTALL,
'use_frozen_modules': 1 if STDLIB_INSTALL else -1,
}
env = self.copy_paths_by_env(config)
self.check_all_configs("test_init_compat_config", config,
Expand Down Expand Up @@ -1381,8 +1386,8 @@ def test_init_pyvenv_cfg(self):
else:
# The current getpath.c doesn't determine the stdlib dir
# in this case.
config['stdlib_dir'] = None
config['use_frozen_modules'] = -1
config['stdlib_dir'] = STDLIB_INSTALL
config['use_frozen_modules'] = 1 if STDLIB_INSTALL else -1

env = self.copy_paths_by_env(config)
self.check_all_configs("test_init_compat_config", config,
Expand Down