summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-03-22 18:56:26 (GMT)
committerGitHub <noreply@github.com>2020-03-22 18:56:26 (GMT)
commitc959fa9353b92ce95dd7fe3f25fe65bacbe22338 (patch)
treee19133af7da40d79fa702460ea23345e018acbf6 /Lib/test
parent687f5921a46cf95c2a648d8031f9e99cdcc3e6b7 (diff)
downloadcpython-c959fa9353b92ce95dd7fe3f25fe65bacbe22338.zip
cpython-c959fa9353b92ce95dd7fe3f25fe65bacbe22338.tar.gz
cpython-c959fa9353b92ce95dd7fe3f25fe65bacbe22338.tar.bz2
bpo-22490: Remove __PYVENV_LAUNCHER__ from environment during launch (GH-9516) (GH-19110)
* bpo-22490: Remove "__PYVENV_LAUNCHER__" from the shell environment on macOS This changeset removes the environment varialbe "__PYVENV_LAUNCHER__" during interpreter launch as it is only needed to communicate between the stub executable in framework installs and the actual interpreter. Leaving the environment variable present may lead to misbehaviour when launching other scripts. * Actually commit the changes for issue 22490... * Correct typo Co-Authored-By: Nicola Soranzo <nicola.soranzo@gmail.com> * Run make patchcheck Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com> (cherry picked from commit 044cf94f610e831464a69a8e713dad89878824ce) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_subprocess.py1
-rw-r--r--Lib/test/test_venv.py12
2 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 80acb06..f8fee36 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -682,7 +682,6 @@ class ProcessTestCase(BaseTestCase):
# on adding even when the environment in exec is empty.
# Gentoo sandboxes also force LD_PRELOAD and SANDBOX_* to exist.
return ('VERSIONER' in n or '__CF' in n or # MacOS
- '__PYVENV_LAUNCHER__' in n or # MacOS framework build
n == 'LD_PRELOAD' or n.startswith('SANDBOX') or # Gentoo
n == 'LC_CTYPE') # Locale coercion triggered
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index ede6593..bc4e95f 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -358,6 +358,18 @@ class BasicTest(BaseTest):
self.assertEqual(err, "".encode())
+ @unittest.skipUnless(sys.platform == 'darwin', 'only relevant on macOS')
+ def test_macos_env(self):
+ rmtree(self.env_dir)
+ builder = venv.EnvBuilder()
+ builder.create(self.env_dir)
+
+ envpy = os.path.join(os.path.realpath(self.env_dir),
+ self.bindir, self.exe)
+ out, err = check_output([envpy, '-c',
+ 'import os; print("__PYVENV_LAUNCHER__" in os.environ)'])
+ self.assertEqual(out.strip(), 'False'.encode())
+
@requireVenvCreate
class EnsurePipTest(BaseTest):
"""Test venv module installation of pip."""