mirror of https://github.com/pypa/pip
Make VersionControl.get_netloc_and_auth() a class method.
This commit is contained in:
parent
8ef3283fcf
commit
67b384b8c7
|
@ -293,7 +293,8 @@ class VersionControl(object):
|
|||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_netloc_and_auth(self, netloc, scheme):
|
||||
@classmethod
|
||||
def get_netloc_and_auth(cls, netloc, scheme):
|
||||
"""
|
||||
Parse the repository URL's netloc, and return the new netloc to use
|
||||
along with auth information.
|
||||
|
|
|
@ -92,7 +92,8 @@ class Subversion(VersionControl):
|
|||
revision = max(revision, localrev)
|
||||
return revision
|
||||
|
||||
def get_netloc_and_auth(self, netloc, scheme):
|
||||
@classmethod
|
||||
def get_netloc_and_auth(cls, netloc, scheme):
|
||||
"""
|
||||
This override allows the auth information to be passed to svn via the
|
||||
--username and --password options instead of via the URL.
|
||||
|
@ -100,8 +101,7 @@ class Subversion(VersionControl):
|
|||
if scheme == 'ssh':
|
||||
# The --username and --password options can't be used for
|
||||
# svn+ssh URLs, so keep the auth information in the URL.
|
||||
return super(Subversion, self).get_netloc_and_auth(
|
||||
netloc, scheme)
|
||||
return super(Subversion, cls).get_netloc_and_auth(netloc, scheme)
|
||||
|
||||
return split_auth_from_netloc(netloc)
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ def test_git__get_netloc_and_auth(args, expected):
|
|||
Test VersionControl.get_netloc_and_auth().
|
||||
"""
|
||||
netloc, scheme = args
|
||||
actual = Git().get_netloc_and_auth(netloc, scheme)
|
||||
actual = Git.get_netloc_and_auth(netloc, scheme)
|
||||
assert actual == expected
|
||||
|
||||
|
||||
|
@ -229,7 +229,7 @@ def test_subversion__get_netloc_and_auth(args, expected):
|
|||
Test Subversion.get_netloc_and_auth().
|
||||
"""
|
||||
netloc, scheme = args
|
||||
actual = Subversion().get_netloc_and_auth(netloc, scheme)
|
||||
actual = Subversion.get_netloc_and_auth(netloc, scheme)
|
||||
assert actual == expected
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue