mirror of https://github.com/pypa/pip
Rename _find_all_versions to find_all_candidates
This commit is contained in:
parent
79dfc985eb
commit
e0904eb5d2
|
@ -347,8 +347,8 @@ class PackageFinder(object):
|
|||
|
||||
return [mkurl_pypi_url(url) for url in self.index_urls]
|
||||
|
||||
def _find_all_versions(self, project_name):
|
||||
"""Find all available versions for project_name
|
||||
def find_all_candidates(self, project_name):
|
||||
"""Find all available InstallationCandidate for project_name
|
||||
|
||||
This checks index_urls, find_links and dependency_links.
|
||||
All versions found are returned as an InstallationCandidate list.
|
||||
|
@ -437,7 +437,7 @@ class PackageFinder(object):
|
|||
Returns a Link if found,
|
||||
Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise
|
||||
"""
|
||||
all_candidates = self._find_all_versions(req.name)
|
||||
all_candidates = self.find_all_candidates(req.name)
|
||||
|
||||
# Filter out anything which doesn't match our specifier
|
||||
_versions = set(
|
||||
|
|
|
@ -274,7 +274,7 @@ def test_finder_priority_file_over_page(data):
|
|||
["http://pypi.python.org/simple"],
|
||||
session=PipSession(),
|
||||
)
|
||||
all_versions = finder._find_all_versions(req.name)
|
||||
all_versions = finder.find_all_candidates(req.name)
|
||||
# 1 file InstallationCandidate followed by all https ones
|
||||
assert all_versions[0].location.scheme == 'file'
|
||||
assert all(version.location.scheme == 'https'
|
||||
|
@ -315,7 +315,7 @@ def test_finder_priority_page_over_deplink():
|
|||
)
|
||||
finder.add_dependency_links([
|
||||
'https://warehouse.python.org/packages/source/p/pip/pip-1.5.6.tar.gz'])
|
||||
all_versions = finder._find_all_versions(req.name)
|
||||
all_versions = finder.find_all_candidates(req.name)
|
||||
# Check that the dependency_link is last
|
||||
assert all_versions[-1].location.url.startswith('https://warehouse')
|
||||
link = finder.find_requirement(req, False)
|
||||
|
@ -330,7 +330,7 @@ def test_finder_priority_nonegg_over_eggfragments():
|
|||
finder = PackageFinder(links, [], session=PipSession())
|
||||
|
||||
with patch.object(finder, "_get_pages", lambda x, y: []):
|
||||
all_versions = finder._find_all_versions(req.name)
|
||||
all_versions = finder.find_all_candidates(req.name)
|
||||
assert all_versions[0].location.url.endswith('tar.gz')
|
||||
assert all_versions[1].location.url.endswith('#egg=bar-1.0')
|
||||
|
||||
|
@ -342,7 +342,7 @@ def test_finder_priority_nonegg_over_eggfragments():
|
|||
finder = PackageFinder(links, [], session=PipSession())
|
||||
|
||||
with patch.object(finder, "_get_pages", lambda x, y: []):
|
||||
all_versions = finder._find_all_versions(req.name)
|
||||
all_versions = finder.find_all_candidates(req.name)
|
||||
assert all_versions[0].location.url.endswith('tar.gz')
|
||||
assert all_versions[1].location.url.endswith('#egg=bar-1.0')
|
||||
link = finder.find_requirement(req, False)
|
||||
|
@ -512,30 +512,30 @@ def test_get_index_urls_locations():
|
|||
'file://index2/complex-name/']
|
||||
|
||||
|
||||
def test_find_all_versions_nothing(data):
|
||||
def test_find_all_candidates_nothing(data):
|
||||
"""Find nothing without anything"""
|
||||
finder = PackageFinder([], [], session=PipSession())
|
||||
assert not finder._find_all_versions('pip')
|
||||
assert not finder.find_all_candidates('pip')
|
||||
|
||||
|
||||
def test_find_all_versions_find_links(data):
|
||||
def test_find_all_candidates_find_links(data):
|
||||
finder = PackageFinder(
|
||||
[data.find_links], [], session=PipSession())
|
||||
versions = finder._find_all_versions('simple')
|
||||
versions = finder.find_all_candidates('simple')
|
||||
assert [str(v.version) for v in versions] == ['3.0', '2.0', '1.0']
|
||||
|
||||
|
||||
def test_find_all_versions_index(data):
|
||||
def test_find_all_candidates_index(data):
|
||||
finder = PackageFinder(
|
||||
[], [data.index_url('simple')], session=PipSession())
|
||||
versions = finder._find_all_versions('simple')
|
||||
versions = finder.find_all_candidates('simple')
|
||||
assert [str(v.version) for v in versions] == ['1.0']
|
||||
|
||||
|
||||
def test_find_all_versions_find_links_and_index(data):
|
||||
def test_find_all_candidates_find_links_and_index(data):
|
||||
finder = PackageFinder(
|
||||
[data.find_links], [data.index_url('simple')], session=PipSession())
|
||||
versions = finder._find_all_versions('simple')
|
||||
versions = finder.find_all_candidates('simple')
|
||||
# first the find-links versions then the page versions
|
||||
assert [str(v.version) for v in versions] == ['3.0', '2.0', '1.0', '1.0']
|
||||
|
||||
|
|
Loading…
Reference in New Issue