Commit 492758af authored by Jason R. Coombs's avatar Jason R. Coombs

Re-use context available in sandbox.

parent fae9ca36
......@@ -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:
......
......@@ -48,14 +48,6 @@ def environment(**replacements):
os.environ.update(saved)
@contextlib.contextmanager
def argv(repl):
old_argv = sys.argv[:]
sys.argv[:] = repl
yield
sys.argv[:] = old_argv
@contextlib.contextmanager
def quiet():
"""
......
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment