|
35 | 35 | MAX_HASH_SEED = 4294967295
|
36 | 36 |
|
37 | 37 |
|
| 38 | +# If we are running from a build dir, but the stdlib has been installed, |
| 39 | +# some tests need to expect different results. |
| 40 | +STDLIB_INSTALL = os.path.join(sys.prefix, sys.platlibdir, |
| 41 | + f'python{sys.version_info.major}.{sys.version_info.minor}') |
| 42 | +if not os.path.isfile(os.path.join(STDLIB_INSTALL, 'os.py')): |
| 43 | + STDLIB_INSTALL = None |
| 44 | + |
38 | 45 | def debug_build(program):
|
39 | 46 | program = os.path.basename(program)
|
40 | 47 | name = os.path.splitext(program)[0]
|
@@ -1307,10 +1314,8 @@ def test_init_pybuilddir(self):
|
1307 | 1314 | 'base_executable': executable,
|
1308 | 1315 | 'executable': executable,
|
1309 | 1316 | 'module_search_paths': module_search_paths,
|
1310 |
| - # The current getpath.c doesn't determine the stdlib dir |
1311 |
| - # in this case. |
1312 |
| - 'stdlib_dir': None, |
1313 |
| - 'use_frozen_modules': -1, |
| 1317 | + 'stdlib_dir': STDLIB_INSTALL, |
| 1318 | + 'use_frozen_modules': 1 if STDLIB_INSTALL else -1, |
1314 | 1319 | }
|
1315 | 1320 | env = self.copy_paths_by_env(config)
|
1316 | 1321 | self.check_all_configs("test_init_compat_config", config,
|
@@ -1381,8 +1386,8 @@ def test_init_pyvenv_cfg(self):
|
1381 | 1386 | else:
|
1382 | 1387 | # The current getpath.c doesn't determine the stdlib dir
|
1383 | 1388 | # in this case.
|
1384 |
| - config['stdlib_dir'] = None |
1385 |
| - config['use_frozen_modules'] = -1 |
| 1389 | + config['stdlib_dir'] = STDLIB_INSTALL |
| 1390 | + config['use_frozen_modules'] = 1 if STDLIB_INSTALL else -1 |
1386 | 1391 |
|
1387 | 1392 | env = self.copy_paths_by_env(config)
|
1388 | 1393 | self.check_all_configs("test_init_compat_config", config,
|
|
0 commit comments