Skip to content

Commit

Permalink
Merge pull request #11080 from sbidoul/requested-with-constraints
Browse files Browse the repository at this point in the history
Fix REQUESTED in presence of URL constraints
  • Loading branch information
pradyunsg authored May 6, 2022
2 parents bab5bfc + 52fd643 commit cf3696a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/11079.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix missing ``REQUESTED`` metadata when using URL constraints.
1 change: 1 addition & 0 deletions src/pip/_internal/req/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,5 @@ def install_req_from_link_and_ireq(
global_options=ireq.global_options,
hash_options=ireq.hash_options,
config_settings=ireq.config_settings,
user_supplied=ireq.user_supplied,
)
37 changes: 37 additions & 0 deletions tests/functional/test_install_requested.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,40 @@ def test_install_requested_in_reqs_and_constraints(
_assert_requested_present(script, result, "require_simple", "1.0")
# simple must have REQUESTED because it is in requirements.txt
_assert_requested_present(script, result, "simple", "2.0")


@pytest.mark.usefixtures("with_wheel")
def test_install_requested_from_cli_with_constraint(
script: PipTestEnvironment, data: TestData
) -> None:
script.scratch_path.joinpath("constraints.txt").write_text("simple<3\n")
result = script.pip(
"install",
"--no-index",
"-f",
data.find_links,
"-c",
script.scratch_path / "constraints.txt",
"simple",
)
# simple must have REQUESTED because it was provided on the command line
_assert_requested_present(script, result, "simple", "2.0")


@pytest.mark.usefixtures("with_wheel")
@pytest.mark.network
def test_install_requested_from_cli_with_url_constraint(
script: PipTestEnvironment, data: TestData
) -> None:
script.scratch_path.joinpath("constraints.txt").write_text(
"pip-test-package @ git+https://github.com/pypa/[email protected]\n"
)
result = script.pip(
"install",
"--no-index",
"-c",
script.scratch_path / "constraints.txt",
"pip-test-package",
)
# pip-test-package must have REQUESTED because it was provided on the command line
_assert_requested_present(script, result, "pip_test_package", "0.1.1")

0 comments on commit cf3696a

Please sign in to comment.