Don't pass "/trunk" when calling local_checkout() with svn.

This commit is contained in:
Chris Jerdonek 2019-09-21 03:01:17 -07:00
parent d7709fa106
commit 188ec6ff4e
4 changed files with 15 additions and 22 deletions

View File

@ -110,9 +110,7 @@ def test_multiple_requirements_files(script, tmpdir):
-r %s-req.txt -r %s-req.txt
""") % """) %
( (
local_checkout( local_checkout('svn+http://svn.colorstudy.com/INITools', tmpdir),
'svn+http://svn.colorstudy.com/INITools/trunk', tmpdir,
),
other_lib_name other_lib_name
), ),
) )

View File

@ -51,9 +51,7 @@ class Tests_UserSite:
result = script.pip( result = script.pip(
'install', '--user', '-e', 'install', '--user', '-e',
'%s#egg=initools' % '%s#egg=initools' %
local_checkout( local_checkout('svn+http://svn.colorstudy.com/INITools', tmpdir)
'svn+http://svn.colorstudy.com/INITools/trunk', tmpdir,
)
) )
result.assert_installed('INITools', use_user_site=True) result.assert_installed('INITools', use_user_site=True)

View File

@ -295,8 +295,8 @@ def test_uninstall_editable_from_svn(script, tmpdir):
""" """
result = script.pip( result = script.pip(
'install', '-e', 'install', '-e',
'%s#egg=initools' % local_checkout( '%s#egg=initools' % (
'svn+http://svn.colorstudy.com/INITools/trunk', tmpdir, local_checkout('svn+http://svn.colorstudy.com/INITools', tmpdir)
), ),
) )
result.assert_installed('INITools') result.assert_installed('INITools')
@ -359,8 +359,7 @@ def test_uninstall_from_reqs_file(script, tmpdir):
""" """
local_svn_url = local_checkout( local_svn_url = local_checkout(
'svn+http://svn.colorstudy.com/INITools/trunk', 'svn+http://svn.colorstudy.com/INITools', tmpdir,
tmpdir,
) )
script.scratch_path.joinpath("test-req.txt").write_text( script.scratch_path.joinpath("test-req.txt").write_text(
textwrap.dedent(""" textwrap.dedent("""

View File

@ -14,13 +14,11 @@ if MYPY_CHECK_RUNNING:
from tests.lib.path import Path from tests.lib.path import Path
def _create_svn_initools_repo(directory): def _create_svn_initools_repo(initools_dir):
""" """
Create the SVN INITools repo. Create the SVN INITools repo.
""" """
initools_dir = os.path.join(directory, 'INITools') directory = os.path.dirname(initools_dir)
assert not os.path.exists(initools_dir)
subprocess.check_call('svnadmin create INITools'.split(), cwd=directory) subprocess.check_call('svnadmin create INITools'.split(), cwd=directory)
filename, _ = urllib_request.urlretrieve( filename, _ = urllib_request.urlretrieve(
@ -38,8 +36,6 @@ def _create_svn_initools_repo(directory):
devnull.close() devnull.close()
os.remove(filename) os.remove(filename)
return os.path.join(initools_dir, 'trunk')
def local_checkout( def local_checkout(
remote_repo, # type: str remote_repo, # type: str
@ -52,19 +48,21 @@ def local_checkout(
created as a sub directory of the base temp directory. created as a sub directory of the base temp directory.
""" """
assert '+' in remote_repo assert '+' in remote_repo
vcs_name, repository_path = remote_repo.split('+', 1) vcs_name = remote_repo.split('+', 1)[0]
repository_name = os.path.basename(remote_repo)
directory = temp_path.joinpath('cache') directory = temp_path.joinpath('cache')
repo_url_path = os.path.join(directory, repository_name)
assert not os.path.exists(repo_url_path)
if not os.path.exists(directory): if not os.path.exists(directory):
os.mkdir(directory) os.mkdir(directory)
if vcs_name == 'svn': if vcs_name == 'svn':
assert remote_repo.endswith('/INITools/trunk') assert repository_name == 'INITools'
repo_url_path = _create_svn_initools_repo(directory) _create_svn_initools_repo(repo_url_path)
repo_url_path = os.path.join(repo_url_path, 'trunk')
else: else:
repository_name = os.path.basename(remote_repo)
repo_url_path = os.path.join(directory, repository_name)
assert not os.path.exists(repo_url_path)
vcs_backend = vcs.get_backend(vcs_name) vcs_backend = vcs.get_backend(vcs_name)
vcs_backend.obtain(repo_url_path, url=hide_url(remote_repo)) vcs_backend.obtain(repo_url_path, url=hide_url(remote_repo))