mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix the assumption that all sources are named. (#5004)
* Fix the assumption that all sources are named. * Add test case * Add news fragment
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
Fixes issue with new index safety restriction, whereby an unnamed extra sources index
|
||||
caused and error to be thrown during install.
|
||||
+1
-1
@@ -1403,7 +1403,7 @@ def pip_install(
|
||||
if index and not extra_indexes:
|
||||
extra_indexes = []
|
||||
if requirement.index:
|
||||
extra_indexes = list(filter(lambda d: d['name'] == requirement.index, project.sources))
|
||||
extra_indexes = list(filter(lambda d: d.get('name') == requirement.index, project.sources))
|
||||
if not extra_indexes:
|
||||
extra_indexes = list(project.sources)
|
||||
if requirement and requirement.vcs or requirement.editable:
|
||||
|
||||
@@ -497,3 +497,30 @@ extras = ["socks"]
|
||||
assert 'six = {version = "*"}' in contents
|
||||
assert 'requests = {version = "*"' in contents
|
||||
assert 'flask = "*"' in contents
|
||||
|
||||
|
||||
@flaky
|
||||
@pytest.mark.dev
|
||||
@pytest.mark.basic
|
||||
@pytest.mark.install
|
||||
@pytest.mark.needs_internet
|
||||
def test_install_with_unnamed_source(PipenvInstance):
|
||||
"""Ensure that running `pipenv install` doesn't break with an unamed index"""
|
||||
with PipenvInstance(chdir=True) as p:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[packages]
|
||||
requests = {version="*", index="pypi"}
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv("install")
|
||||
assert c.returncode == 0
|
||||
|
||||
Reference in New Issue
Block a user