aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-02-03 22:28:29 +0400
committerJason R. Coombs <jaraco@jaraco.com>2015-02-03 22:28:29 +0400
commit492758aff46622fb93845f96b9062dab029064f4 (patch)
tree32f9f15232171b94e9dd0ca36cfd4d700bbc0d7a
parentfae9ca36955cdaebb81936bb54c3e9e44b5e6928 (diff)
downloadexternal_python_setuptools-492758aff46622fb93845f96b9062dab029064f4.tar.gz
external_python_setuptools-492758aff46622fb93845f96b9062dab029064f4.tar.bz2
external_python_setuptools-492758aff46622fb93845f96b9062dab029064f4.zip
Re-use context available in sandbox.
-rwxr-xr-xsetuptools/sandbox.py4
-rw-r--r--setuptools/tests/contexts.py8
-rw-r--r--setuptools/tests/test_easy_install.py2
3 files changed, 4 insertions, 10 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 83283ca3..67255123 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -47,8 +47,10 @@ def _execfile(filename, globals, locals=None):
@contextlib.contextmanager
-def save_argv():
+def save_argv(repl=None):
saved = sys.argv[:]
+ if repl is not None:
+ sys.argv[:] = repl
try:
yield saved
finally:
diff --git a/setuptools/tests/contexts.py b/setuptools/tests/contexts.py
index 4a461765..1d29284b 100644
--- a/setuptools/tests/contexts.py
+++ b/setuptools/tests/contexts.py
@@ -49,14 +49,6 @@ def environment(**replacements):
@contextlib.contextmanager
-def argv(repl):
- old_argv = sys.argv[:]
- sys.argv[:] = repl
- yield
- sys.argv[:] = old_argv
-
-
-@contextlib.contextmanager
def quiet():
"""
Redirect stdout/stderr to StringIO objects to prevent console output from
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 4331d30e..b9b2e392 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -312,7 +312,7 @@ class TestSetupRequires:
'--install-dir', temp_install_dir,
dist_file,
]
- with contexts.argv(['easy_install']):
+ with sandbox.save_argv(['easy_install']):
# attempt to install the dist. It should fail because
# it doesn't exist.
with pytest.raises(SystemExit):