summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_venv.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-12-23 06:16:07 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2013-12-23 06:16:07 (GMT)
commit6256fcbc97e0b1a1e0df1972221232b3a78dff18 (patch)
treee901b7ff5795dfb5fbaffb2483d99fbaea91f851 /Lib/test/test_venv.py
parent3f122d6f44d2cdf0a806fa8019d58ea24cfdf070 (diff)
downloadcpython-6256fcbc97e0b1a1e0df1972221232b3a78dff18.zip
cpython-6256fcbc97e0b1a1e0df1972221232b3a78dff18.tar.gz
cpython-6256fcbc97e0b1a1e0df1972221232b3a78dff18.tar.bz2
Close #19734: ignore pip env vars in ensurepip
Diffstat (limited to 'Lib/test/test_venv.py')
-rw-r--r--Lib/test/test_venv.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index eb225fa..e8437cf 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -294,11 +294,12 @@ class EnsurePipTest(BaseTest):
# warnings in current versions of Python. Ensure related
# environment settings don't cause venv to fail.
envvars["PYTHONWARNINGS"] = "e"
- # pip doesn't ignore environment variables when running in
- # isolated mode, and we don't have an active virtualenv here,
- # we're relying on the native venv support in 3.3+
+ # ensurepip is different enough from a normal pip invocation
+ # that we want to ensure it ignores the normal pip environment
+ # variable settings. We set PIP_NO_INSTALL here specifically
+ # to check that ensurepip (and hence venv) ignores it.
# See http://bugs.python.org/issue19734 for details
- del envvars["PIP_REQUIRE_VIRTUALENV"]
+ envvars["PIP_NO_INSTALL"] = "1"
try:
self.run_with_capture(venv.create, self.env_dir, with_pip=True)
except subprocess.CalledProcessError as exc:
@@ -328,11 +329,6 @@ class EnsurePipTest(BaseTest):
# installers works (at least in a virtual environment)
cmd = [envpy, '-Im', 'ensurepip._uninstall']
with EnvironmentVarGuard() as envvars:
- # pip doesn't ignore environment variables when running in
- # isolated mode, and we don't have an active virtualenv here,
- # we're relying on the native venv support in 3.3+
- # See http://bugs.python.org/issue19734 for details
- del envvars["PIP_REQUIRE_VIRTUALENV"]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate()