Skip to content

Commit 3c62d1c

Browse files
committed
Add failing test for REQUESTED and URL constraints
1 parent f51d471 commit 3c62d1c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/functional/test_install_requested.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,40 @@ def test_install_requested_in_reqs_and_constraints(
110110
_assert_requested_present(script, result, "require_simple", "1.0")
111111
# simple must have REQUESTED because it is in requirements.txt
112112
_assert_requested_present(script, result, "simple", "2.0")
113+
114+
115+
@pytest.mark.usefixtures("with_wheel")
116+
def test_install_requested_from_cli_with_constraint(
117+
script: PipTestEnvironment, data: TestData
118+
) -> None:
119+
script.scratch_path.joinpath("constraints.txt").write_text("simple<3\n")
120+
result = script.pip(
121+
"install",
122+
"--no-index",
123+
"-f",
124+
data.find_links,
125+
"-c",
126+
script.scratch_path / "constraints.txt",
127+
"simple",
128+
)
129+
# simple must have REQUESTED because it was provided on the command line
130+
_assert_requested_present(script, result, "simple", "2.0")
131+
132+
133+
@pytest.mark.usefixtures("with_wheel")
134+
@pytest.mark.network
135+
def test_install_requested_from_cli_with_url_constraint(
136+
script: PipTestEnvironment, data: TestData
137+
) -> None:
138+
script.scratch_path.joinpath("constraints.txt").write_text(
139+
"pip-test-package @ git+https://github.com/pypa/[email protected]\n"
140+
)
141+
result = script.pip(
142+
"install",
143+
"--no-index",
144+
"-c",
145+
script.scratch_path / "constraints.txt",
146+
"pip-test-package",
147+
)
148+
# pip-test-package must have REQUESTED because it was provided on the command line
149+
_assert_requested_present(script, result, "pip_test_package", "0.1.1")

0 commit comments

Comments
 (0)