Skip to content

Commit 8e3c3b5

Browse files
[3.14] gh-133742: Fix test_sysconfig and test_build_details for relocated directories (GH-136987) (#136990)
gh-133742: Fix test_sysconfig and test_build_details for relocated directories (GH-136987) (cherry picked from commit aafbdb5) Co-authored-by: Pablo Galindo Salgado <[email protected]>
1 parent daa2fd7 commit 8e3c3b5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Lib/test/test_build_details.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ def test_location(self):
124124
def test_base_interpreter(self):
125125
value = self.key('base_interpreter')
126126

127+
# Skip check if installation is relocated
128+
if sysconfig._installation_is_relocated():
129+
self.skipTest("Installation is relocated")
130+
127131
self.assertEqual(os.path.realpath(value), os.path.realpath(sys.executable))
128132

129133
@needs_installed_python
@@ -133,6 +137,11 @@ def test_base_interpreter(self):
133137
)
134138
def test_c_api(self):
135139
value = self.key('c_api')
140+
141+
# Skip check if installation is relocated
142+
if sysconfig._installation_is_relocated():
143+
self.skipTest("Installation is relocated")
144+
136145
self.assertTrue(os.path.exists(os.path.join(value['headers'], 'Python.h')))
137146
version = sysconfig.get_config_var('VERSION')
138147
self.assertTrue(os.path.exists(os.path.join(value['pkgconfig_path'], f'python-{version}.pc')))

Lib/test/test_sysconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ def test_sysconfigdata_json(self):
709709
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase'}
710710
# Keys dependent on Python being run from the prefix targetted when building (different on relocatable installs)
711711
if sysconfig._installation_is_relocated():
712-
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase', 'installed_base', 'installed_platbase'}
712+
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase', 'installed_base', 'installed_platbase', 'srcdir'}
713713

714714
for key in ignore_keys:
715715
json_config_vars.pop(key, None)

0 commit comments

Comments
 (0)