Skip to content

Commit

Permalink
Add unit tests for Git SSH parsing + remove a bug with explicit SSH URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
ludovic-gasc committed Mar 11, 2015
1 parent fa13011 commit 10f7084
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pip/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ def get_url_rev(self):
url = url.replace('ssh://', '')
else:
url, rev = super(Git, self).get_url_rev()
# For explicit SSH URLs, remove 'ssh://' to clone
url = url.replace('ssh://', '')

return url, rev

Expand Down
31 changes: 31 additions & 0 deletions tests/unit/test_vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,37 @@ def test_git_get_src_requirements():
])


def test_git_urls():
"""
Test git url support.
SSH has special handling.
"""
https_repo = Git(
url='git+https://github.com/Eyepea/pip.git@8cf54fff31b650847e0cddc2cd2951c34e0b4822#egg=pip'
)
implicit_ssh_repo = Git(
url='git+git@github.com:Eyepea/pip.git@8cf54fff31b650847e0cddc2cd2951c34e0b4822#egg=pip'
)

explicit_ssh_repo = Git(
url='git+ssh://git@github.com:Eyepea/pip.git@8cf54fff31b650847e0cddc2cd2951c34e0b4822#egg=pip'
)

assert https_repo.get_url_rev() == (
'https://github.com/Eyepea/pip.git',
'8cf54fff31b650847e0cddc2cd2951c34e0b4822',
)
assert implicit_ssh_repo.get_url_rev() == (
'git@github.com:Eyepea/pip.git',
'8cf54fff31b650847e0cddc2cd2951c34e0b4822',
)
assert explicit_ssh_repo.get_url_rev() == (
'git@github.com:Eyepea/pip.git',
'8cf54fff31b650847e0cddc2cd2951c34e0b4822',
)


def test_translate_egg_surname():
vc = VersionControl()
assert vc.translate_egg_surname("foo") == "foo"
Expand Down

0 comments on commit 10f7084

Please sign in to comment.