diff --git a/tests/test_config.py b/tests/test_config.py index 6c14fa19b..86915ddec 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -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) diff --git a/tests/test_uninstall.py b/tests/test_uninstall.py index 0221ab1b6..f0c3c3545 100644 --- a/tests/test_uninstall.py +++ b/tests/test_uninstall.py @@ -1,5 +1,6 @@ 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)