mirror of https://github.com/pypa/pip
Correction to account for vcs only (no index urls)
This commit is contained in:
parent
ae3f7f4906
commit
e862bc9c4e
|
@ -136,6 +136,6 @@ class SearchScope:
|
|||
index_urls = self.index_urls
|
||||
if project_name in self.index_lookup:
|
||||
index_urls = [self.index_lookup[project_name]]
|
||||
else:
|
||||
elif self.index_urls:
|
||||
index_urls = [self.index_urls[0]]
|
||||
return [mkurl_pypi_url(url) for url in index_urls]
|
||||
|
|
|
@ -25,8 +25,8 @@ class TestSearchScope:
|
|||
assert "links-user:****@page.domain.com" in result
|
||||
assert "links-pass" not in result
|
||||
|
||||
def test_get_index_urls_locations(self) -> None:
|
||||
"""Check that the canonical name is on all indexes"""
|
||||
def test_get_index_urls_location_default(self) -> None:
|
||||
"""Check that the default index url is used when no index is specified."""
|
||||
search_scope = SearchScope(
|
||||
find_links=[],
|
||||
index_urls=["file://index1/", "file://index2"],
|
||||
|
@ -35,7 +35,17 @@ class TestSearchScope:
|
|||
req = install_req_from_line("Complex_Name")
|
||||
assert req.name is not None
|
||||
actual = search_scope.get_index_urls_locations(req.name)
|
||||
assert actual == [
|
||||
"file://index1/complex-name/",
|
||||
"file://index2/complex-name/",
|
||||
]
|
||||
assert actual == ["file://index1/complex-name/"]
|
||||
|
||||
def test_get_index_urls_location_specified(self) -> None:
|
||||
"""Check that the specified index url is used."""
|
||||
search_scope = SearchScope(
|
||||
find_links=[],
|
||||
index_urls=["file://index1/", "file://index2"],
|
||||
no_index=False,
|
||||
index_lookup={"complex-name": "file://index2"},
|
||||
)
|
||||
req = install_req_from_line("Complex_Name")
|
||||
assert req.name is not None
|
||||
actual = search_scope.get_index_urls_locations(req.name)
|
||||
assert actual == ["file://index2/complex-name/"]
|
||||
|
|
Loading…
Reference in New Issue