From d7709fa1061600e0606f8732f0fb1e4fb98fb874 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Thu, 19 Sep 2019 00:50:16 -0700 Subject: [PATCH] Assert that initools_dir doesn't already exist. --- tests/functional/test_uninstall.py | 10 ++++++---- tests/lib/local_repos.py | 12 +++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py index 8ea542246..0ec1cd38b 100644 --- a/tests/functional/test_uninstall.py +++ b/tests/functional/test_uninstall.py @@ -358,13 +358,16 @@ def test_uninstall_from_reqs_file(script, tmpdir): Test uninstall from a requirements file. """ + local_svn_url = local_checkout( + 'svn+http://svn.colorstudy.com/INITools/trunk', + tmpdir, + ) script.scratch_path.joinpath("test-req.txt").write_text( textwrap.dedent(""" -e %s#egg=initools # and something else to test out: PyLogo<0.4 - """) % - local_checkout('svn+http://svn.colorstudy.com/INITools/trunk', tmpdir) + """) % local_svn_url ) result = script.pip('install', '-r', 'test-req.txt') script.scratch_path.joinpath("test-req.txt").write_text( @@ -377,8 +380,7 @@ def test_uninstall_from_reqs_file(script, tmpdir): -e %s#egg=initools # and something else to test out: PyLogo<0.4 - """) % - local_checkout('svn+http://svn.colorstudy.com/INITools/trunk', tmpdir) + """) % local_svn_url ) result2 = script.pip('uninstall', '-r', 'test-req.txt', '-y') assert_all_changes( diff --git a/tests/lib/local_repos.py b/tests/lib/local_repos.py index fe896f7f3..5b15b9b65 100644 --- a/tests/lib/local_repos.py +++ b/tests/lib/local_repos.py @@ -14,14 +14,12 @@ if MYPY_CHECK_RUNNING: from tests.lib.path import Path -def _ensure_svn_initools_repo(directory): +def _create_svn_initools_repo(directory): """ - Create the SVN INITools repo if it doesn't already exist. + Create the SVN INITools repo. """ initools_dir = os.path.join(directory, 'INITools') - repo_url_path = os.path.join(initools_dir, 'trunk') - if os.path.exists(initools_dir): - return repo_url_path + assert not os.path.exists(initools_dir) subprocess.check_call('svnadmin create INITools'.split(), cwd=directory) @@ -40,7 +38,7 @@ def _ensure_svn_initools_repo(directory): devnull.close() os.remove(filename) - return repo_url_path + return os.path.join(initools_dir, 'trunk') def local_checkout( @@ -62,7 +60,7 @@ def local_checkout( if vcs_name == 'svn': assert remote_repo.endswith('/INITools/trunk') - repo_url_path = _ensure_svn_initools_repo(directory) + repo_url_path = _create_svn_initools_repo(directory) else: repository_name = os.path.basename(remote_repo) repo_url_path = os.path.join(directory, repository_name)