Assert that initools_dir doesn't already exist.

This commit is contained in:
Chris Jerdonek 2019-09-19 00:50:16 -07:00
parent 1ca61e14ba
commit d7709fa106
2 changed files with 11 additions and 11 deletions

View File

@ -358,13 +358,16 @@ def test_uninstall_from_reqs_file(script, tmpdir):
Test uninstall from a requirements file. 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( script.scratch_path.joinpath("test-req.txt").write_text(
textwrap.dedent(""" textwrap.dedent("""
-e %s#egg=initools -e %s#egg=initools
# and something else to test out: # and something else to test out:
PyLogo<0.4 PyLogo<0.4
""") % """) % local_svn_url
local_checkout('svn+http://svn.colorstudy.com/INITools/trunk', tmpdir)
) )
result = script.pip('install', '-r', 'test-req.txt') result = script.pip('install', '-r', 'test-req.txt')
script.scratch_path.joinpath("test-req.txt").write_text( 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 -e %s#egg=initools
# and something else to test out: # and something else to test out:
PyLogo<0.4 PyLogo<0.4
""") % """) % local_svn_url
local_checkout('svn+http://svn.colorstudy.com/INITools/trunk', tmpdir)
) )
result2 = script.pip('uninstall', '-r', 'test-req.txt', '-y') result2 = script.pip('uninstall', '-r', 'test-req.txt', '-y')
assert_all_changes( assert_all_changes(

View File

@ -14,14 +14,12 @@ if MYPY_CHECK_RUNNING:
from tests.lib.path import Path 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') initools_dir = os.path.join(directory, 'INITools')
repo_url_path = os.path.join(initools_dir, 'trunk') assert not os.path.exists(initools_dir)
if os.path.exists(initools_dir):
return repo_url_path
subprocess.check_call('svnadmin create INITools'.split(), cwd=directory) subprocess.check_call('svnadmin create INITools'.split(), cwd=directory)
@ -40,7 +38,7 @@ def _ensure_svn_initools_repo(directory):
devnull.close() devnull.close()
os.remove(filename) os.remove(filename)
return repo_url_path return os.path.join(initools_dir, 'trunk')
def local_checkout( def local_checkout(
@ -62,7 +60,7 @@ def local_checkout(
if vcs_name == 'svn': if vcs_name == 'svn':
assert remote_repo.endswith('/INITools/trunk') assert remote_repo.endswith('/INITools/trunk')
repo_url_path = _ensure_svn_initools_repo(directory) repo_url_path = _create_svn_initools_repo(directory)
else: else:
repository_name = os.path.basename(remote_repo) repository_name = os.path.basename(remote_repo)
repo_url_path = os.path.join(directory, repository_name) repo_url_path = os.path.join(directory, repository_name)