gh-133742: Fix test_sysconfig and test_build_details for relocated directories (#136987)
This commit is contained in:
committed by
GitHub
parent
4d02f31cdd
commit
aafbdb5df5
@@ -124,6 +124,10 @@ class CPythonBuildDetailsTests(unittest.TestCase, FormatTestsBase):
|
|||||||
def test_base_interpreter(self):
|
def test_base_interpreter(self):
|
||||||
value = self.key('base_interpreter')
|
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))
|
self.assertEqual(os.path.realpath(value), os.path.realpath(sys.executable))
|
||||||
|
|
||||||
@needs_installed_python
|
@needs_installed_python
|
||||||
@@ -133,6 +137,11 @@ class CPythonBuildDetailsTests(unittest.TestCase, FormatTestsBase):
|
|||||||
)
|
)
|
||||||
def test_c_api(self):
|
def test_c_api(self):
|
||||||
value = self.key('c_api')
|
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')))
|
self.assertTrue(os.path.exists(os.path.join(value['headers'], 'Python.h')))
|
||||||
version = sysconfig.get_config_var('VERSION')
|
version = sysconfig.get_config_var('VERSION')
|
||||||
self.assertTrue(os.path.exists(os.path.join(value['pkgconfig_path'], f'python-{version}.pc')))
|
self.assertTrue(os.path.exists(os.path.join(value['pkgconfig_path'], f'python-{version}.pc')))
|
||||||
|
|||||||
@@ -708,7 +708,7 @@ class TestSysConfig(unittest.TestCase, VirtualEnvironmentMixin):
|
|||||||
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase'}
|
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase'}
|
||||||
# Keys dependent on Python being run from the prefix targetted when building (different on relocatable installs)
|
# Keys dependent on Python being run from the prefix targetted when building (different on relocatable installs)
|
||||||
if sysconfig._installation_is_relocated():
|
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:
|
for key in ignore_keys:
|
||||||
json_config_vars.pop(key, None)
|
json_config_vars.pop(key, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user