提交 ec76495f 编写于 作者: H Hugo Lopes Tavares

work around to always remove temp files/dirs the test function creates

上级 11cc0b65
......@@ -69,7 +69,14 @@ def test_config_file_override_stack():
local, overriding all with a command line flag).
"""
f, config_file = tempfile.mkstemp('-pip.cfg', 'test-')
try:
_, config_file = tempfile.mkstemp('-pip.cfg', 'test-')
_test_config_file_override_stack(config_file)
finally:
os.remove(config_file)
def _test_config_file_override_stack(config_file):
environ = clear_environ(os.environ.copy())
environ['PIP_CONFIG_FILE'] = config_file # set this to make pip load it
reset_env(environ)
......
import textwrap
import sys
import shutil
from os.path import join
from tempfile import mkdtemp
from test_pip import reset_env, run_pip, assert_all_changes, write_file
......@@ -89,7 +90,15 @@ def test_uninstall_editable_with_source_outside_venv():
Test uninstalling editable install from existing source outside the venv.
"""
tmpdir = join(mkdtemp(), 'virtualenv')
try:
temp = mkdtemp()
tmpdir = join(temp, 'virtualenv')
_test_uninstall_editable_with_source_outside_venv(tmpdir)
finally:
shutil.rmtree(temp)
def _test_uninstall_editable_with_source_outside_venv(tmpdir):
env = reset_env()
result = env.run('hg', 'clone', local_repo('hg+http://bitbucket.org/ianb/virtualenv'), tmpdir)
result2 = run_pip('install', '-e', tmpdir)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册