Skip to content

fix(pip/req/req_set): Dont err on double reqs of the same spec #3372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pip/req/req_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ def add_requirement(self, install_req, parent_req_name=None):
existing_req = None
if (parent_req_name is None and existing_req and not
existing_req.constraint and
existing_req.extras == install_req.extras):
existing_req.extras == install_req.extras and not
existing_req.req.specs == install_req.req.specs):
raise InstallationError(
'Double requirement given: %s (already in %s, name=%r)'
% (install_req, existing_req, name))
Expand Down
19 changes: 19 additions & 0 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,3 +932,22 @@ def test_install_tar_lzma(script, data):
pytest.skip("No lzma support")
res = script.pip('install', data.packages / 'singlemodule-0.0.1.tar.lzma')
assert "Successfully installed singlemodule-0.0.1" in res.stdout, res


def test_double_install(script, data):
"""
Test double install passing with two same version requirements
"""
result = script.pip('install', 'pip', 'pip', expect_error=False)
msg = "Double requirement given: pip (already in pip, name='pip')"
assert msg not in result.stderr


def test_double_install_fail(script, data):
"""
Test double install failing with two different version requirements
"""
result = script.pip('install', 'pip==*', 'pip==7.1.2', expect_error=True)
msg = ("Double requirement given: pip==7.1.2 (already in pip==*, "
"name='pip')")
assert msg in result.stderr