]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-133742: Fix test_sysconfig and test_build_details for relocated directories...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 22 Jul 2025 12:18:23 +0000 (14:18 +0200)
committerGitHub <noreply@github.com>
Tue, 22 Jul 2025 12:18:23 +0000 (12:18 +0000)
gh-133742: Fix test_sysconfig and test_build_details for relocated directories (GH-136987)
(cherry picked from commit aafbdb5df5439adc1106ced068cf87683ae68b9e)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Lib/test/test_build_details.py
Lib/test/test_sysconfig.py

index ba4b8c5aa9b58e1a9b86f3d55f898c1b03d36ae1..691fd0bb98c097896271f1478168b53afcc5b4e6 100644 (file)
@@ -124,6 +124,10 @@ class CPythonBuildDetailsTests(unittest.TestCase, FormatTestsBase):
     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
@@ -133,6 +137,11 @@ class CPythonBuildDetailsTests(unittest.TestCase, FormatTestsBase):
     )
     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')))
index 7af3144d69197e3d53d3a1b188320ce8c17f61a1..9faabc2e25447f2e095bc5ce4b612a2054530599 100644 (file)
@@ -709,7 +709,7 @@ class TestSysConfig(unittest.TestCase, VirtualEnvironmentMixin):
             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)