diff options
author | Steve Dower <steve.dower@python.org> | 2019-06-29 17:34:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-29 17:34:11 (GMT) |
commit | 9048c49322a5229ff99610aba35913ffa295ebb7 (patch) | |
tree | caad6f4a3b44e547208ac70cc1746c4df349ac8f /Lib/test/test_httpservers.py | |
parent | 80097e089ba22a42d804e65fbbcf35e5e49eed00 (diff) | |
download | cpython-9048c49322a5229ff99610aba35913ffa295ebb7.zip cpython-9048c49322a5229ff99610aba35913ffa295ebb7.tar.gz cpython-9048c49322a5229ff99610aba35913ffa295ebb7.tar.bz2 |
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_httpservers.py')
-rw-r--r-- | Lib/test/test_httpservers.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 8357ee9..87d4924 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -610,9 +610,10 @@ class CGIHTTPServerTestCase(BaseTestCase): # The shebang line should be pure ASCII: use symlink if possible. # See issue #7668. + self._pythonexe_symlink = None if support.can_symlink(): self.pythonexe = os.path.join(self.parent_dir, 'python') - os.symlink(sys.executable, self.pythonexe) + self._pythonexe_symlink = support.PythonSymlink(self.pythonexe).__enter__() else: self.pythonexe = sys.executable @@ -655,8 +656,8 @@ class CGIHTTPServerTestCase(BaseTestCase): def tearDown(self): try: os.chdir(self.cwd) - if self.pythonexe != sys.executable: - os.remove(self.pythonexe) + if self._pythonexe_symlink: + self._pythonexe_symlink.__exit__(None, None, None) if self.nocgi_path: os.remove(self.nocgi_path) if self.file1_path: |