summaryrefslogtreecommitdiff
path: root/Lib/test/test_embed.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2019-06-29 10:34:11 -0700
committerGitHub <noreply@github.com>2019-06-29 10:34:11 -0700
commit9048c49322a5229ff99610aba35913ffa295ebb7 (patch)
treecaad6f4a3b44e547208ac70cc1746c4df349ac8f /Lib/test/test_embed.py
parent80097e089ba22a42d804e65fbbcf35e5e49eed00 (diff)
downloadcpython-git-9048c49322a5229ff99610aba35913ffa295ebb7.tar.gz
bpo-37369: Fix initialization of sys members when launched via an app container (GH-14428)
sys._base_executable is now always defined on all platforms, and can be overridden through configuration. Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
Diffstat (limited to 'Lib/test/test_embed.py')
-rw-r--r--Lib/test/test_embed.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index b89748938b..9c78aa059f 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -362,6 +362,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
'pythonpath_env': None,
'home': None,
'executable': GET_DEFAULT_CONFIG,
+ 'base_executable': GET_DEFAULT_CONFIG,
'prefix': GET_DEFAULT_CONFIG,
'base_prefix': GET_DEFAULT_CONFIG,
@@ -534,14 +535,16 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
if expected['stdio_errors'] is self.GET_DEFAULT_CONFIG:
expected['stdio_errors'] = 'surrogateescape'
+ if sys.platform == 'win32':
+ default_executable = self.test_exe
+ elif expected['program_name'] is not self.GET_DEFAULT_CONFIG:
+ default_executable = os.path.abspath(expected['program_name'])
+ else:
+ default_executable = os.path.join(os.getcwd(), '_testembed')
if expected['executable'] is self.GET_DEFAULT_CONFIG:
- if sys.platform == 'win32':
- expected['executable'] = self.test_exe
- else:
- if expected['program_name'] is not self.GET_DEFAULT_CONFIG:
- expected['executable'] = os.path.abspath(expected['program_name'])
- else:
- expected['executable'] = os.path.join(os.getcwd(), '_testembed')
+ expected['executable'] = default_executable
+ if expected['base_executable'] is self.GET_DEFAULT_CONFIG:
+ expected['base_executable'] = default_executable
if expected['program_name'] is self.GET_DEFAULT_CONFIG:
expected['program_name'] = './_testembed'