diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-09-26 02:01:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-26 02:01:49 (GMT) |
commit | 49d99f01e6e51acec5ca57a02e857f0796bc418b (patch) | |
tree | b38801ae16e872c8739d3fa4cd03c1e923ff5bbe /Lib/test/test_embed.py | |
parent | 88feaecd46a8f427e30ef7ad8cfcddfe392a2402 (diff) | |
download | cpython-49d99f01e6e51acec5ca57a02e857f0796bc418b.zip cpython-49d99f01e6e51acec5ca57a02e857f0796bc418b.tar.gz cpython-49d99f01e6e51acec5ca57a02e857f0796bc418b.tar.bz2 |
bpo-38234: Fix test_embed.test_init_setpath_config() on FreeBSD (GH-16406)
Explicitly preinitializes with a Python preconfiguration to avoid
Py_SetPath() implicit preinitialization with a compat
preconfiguration.
Fix also test_init_setpath() and test_init_setpythonhome() on macOS:
use self.test_exe as the executable (and base_executable), rather
than shutil.which('python3').
Diffstat (limited to 'Lib/test/test_embed.py')
-rw-r--r-- | Lib/test/test_embed.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 8855e90..92b5136 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -15,6 +15,7 @@ import textwrap MS_WINDOWS = (os.name == 'nt') +MACOS = (sys.platform == 'darwin') PYMEM_ALLOCATOR_NOT_SET = 0 PYMEM_ALLOCATOR_DEBUG = 2 @@ -1011,7 +1012,10 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): executable = self.test_exe else: program_name = 'python3' - executable = shutil.which(program_name) or '' + if MACOS: + executable = self.test_exe + else: + executable = shutil.which(program_name) or '' config.update({ 'program_name': program_name, 'base_executable': executable, @@ -1054,13 +1058,8 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'executable': 'conf_executable', } env = {'TESTPATH': os.path.pathsep.join(paths)} - # Py_SetPath() preinitialized Python using the compat API, - # so we need preconfig_api=API_COMPAT. self.check_all_configs("test_init_setpath_config", config, - api=API_PYTHON, - preconfig_api=API_COMPAT, - env=env, - ignore_stderr=True) + api=API_PYTHON, env=env, ignore_stderr=True) def module_search_paths(self, prefix=None, exec_prefix=None): config = self._get_expected_config() |