From 188ec6ff4e976ac9b82ac134a9925cf1ab5d88fd Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Sat, 21 Sep 2019 03:01:17 -0700 Subject: [PATCH] Don't pass "/trunk" when calling local_checkout() with svn. --- tests/functional/test_install_reqs.py | 4 +--- tests/functional/test_install_user.py | 4 +--- tests/functional/test_uninstall.py | 7 +++---- tests/lib/local_repos.py | 22 ++++++++++------------ 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py index b906c37b6..e0eed8715 100644 --- a/tests/functional/test_install_reqs.py +++ b/tests/functional/test_install_reqs.py @@ -110,9 +110,7 @@ def test_multiple_requirements_files(script, tmpdir): -r %s-req.txt """) % ( - local_checkout( - 'svn+http://svn.colorstudy.com/INITools/trunk', tmpdir, - ), + local_checkout('svn+http://svn.colorstudy.com/INITools', tmpdir), other_lib_name ), ) diff --git a/tests/functional/test_install_user.py b/tests/functional/test_install_user.py index d668ed12c..537f40276 100644 --- a/tests/functional/test_install_user.py +++ b/tests/functional/test_install_user.py @@ -51,9 +51,7 @@ class Tests_UserSite: result = script.pip( 'install', '--user', '-e', '%s#egg=initools' % - local_checkout( - 'svn+http://svn.colorstudy.com/INITools/trunk', tmpdir, - ) + local_checkout('svn+http://svn.colorstudy.com/INITools', tmpdir) ) result.assert_installed('INITools', use_user_site=True) diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py index 0ec1cd38b..13d18768e 100644 --- a/tests/functional/test_uninstall.py +++ b/tests/functional/test_uninstall.py @@ -295,8 +295,8 @@ def test_uninstall_editable_from_svn(script, tmpdir): """ result = script.pip( 'install', '-e', - '%s#egg=initools' % local_checkout( - 'svn+http://svn.colorstudy.com/INITools/trunk', tmpdir, + '%s#egg=initools' % ( + local_checkout('svn+http://svn.colorstudy.com/INITools', tmpdir) ), ) result.assert_installed('INITools') @@ -359,8 +359,7 @@ def test_uninstall_from_reqs_file(script, tmpdir): """ local_svn_url = local_checkout( - 'svn+http://svn.colorstudy.com/INITools/trunk', - tmpdir, + 'svn+http://svn.colorstudy.com/INITools', tmpdir, ) script.scratch_path.joinpath("test-req.txt").write_text( textwrap.dedent(""" diff --git a/tests/lib/local_repos.py b/tests/lib/local_repos.py index 5b15b9b65..2a41595f9 100644 --- a/tests/lib/local_repos.py +++ b/tests/lib/local_repos.py @@ -14,13 +14,11 @@ if MYPY_CHECK_RUNNING: from tests.lib.path import Path -def _create_svn_initools_repo(directory): +def _create_svn_initools_repo(initools_dir): """ Create the SVN INITools repo. """ - initools_dir = os.path.join(directory, 'INITools') - assert not os.path.exists(initools_dir) - + directory = os.path.dirname(initools_dir) subprocess.check_call('svnadmin create INITools'.split(), cwd=directory) filename, _ = urllib_request.urlretrieve( @@ -38,8 +36,6 @@ def _create_svn_initools_repo(directory): devnull.close() os.remove(filename) - return os.path.join(initools_dir, 'trunk') - def local_checkout( remote_repo, # type: str @@ -52,19 +48,21 @@ def local_checkout( created as a sub directory of the base temp directory. """ 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') + repo_url_path = os.path.join(directory, repository_name) + assert not os.path.exists(repo_url_path) + if not os.path.exists(directory): os.mkdir(directory) if vcs_name == 'svn': - assert remote_repo.endswith('/INITools/trunk') - repo_url_path = _create_svn_initools_repo(directory) + assert repository_name == 'INITools' + _create_svn_initools_repo(repo_url_path) + repo_url_path = os.path.join(repo_url_path, 'trunk') 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.obtain(repo_url_path, url=hide_url(remote_repo))