Skip to content

[3.14] gh-133742: Fix test_sysconfig and test_build_details for relocated directories (GH-136987) #136990

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
Jul 22, 2025
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions Lib/test/test_build_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def test_location(self):
def test_base_interpreter(self):
value = self.key('base_interpreter')

# Skip check if installation is relocated
if sysconfig._installation_is_relocated():
self.skipTest("Installation is relocated")

self.assertEqual(os.path.realpath(value), os.path.realpath(sys.executable))

@needs_installed_python
Expand All @@ -133,6 +137,11 @@ def test_base_interpreter(self):
)
def test_c_api(self):
value = self.key('c_api')

# Skip check if installation is relocated
if sysconfig._installation_is_relocated():
self.skipTest("Installation is relocated")

self.assertTrue(os.path.exists(os.path.join(value['headers'], 'Python.h')))
version = sysconfig.get_config_var('VERSION')
self.assertTrue(os.path.exists(os.path.join(value['pkgconfig_path'], f'python-{version}.pc')))
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def test_sysconfigdata_json(self):
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase'}
# Keys dependent on Python being run from the prefix targetted when building (different on relocatable installs)
if sysconfig._installation_is_relocated():
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase', 'installed_base', 'installed_platbase'}
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase', 'installed_base', 'installed_platbase', 'srcdir'}

for key in ignore_keys:
json_config_vars.pop(key, None)
Expand Down
Loading