Skip to content

Commit c4d9f56

Browse files
committed
Add failing test for extra-already-installed case
1 parent b160e83 commit c4d9f56

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/functional/test_new_resolver.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,3 +2180,36 @@ def test_new_resolver_dont_backtrack_on_extra_if_base_constrained(script):
21802180
)
21812181
assert "pkg-2.0" not in result.stdout, "Should not try 2.0 due to constraint"
21822182
script.assert_installed(pkg="1.0", dep="1.0")
2183+
2184+
2185+
def test_new_resolver_respect_user_requested_if_extra_is_installed(script):
2186+
create_basic_wheel_for_package(script, "pkg1", "1.0")
2187+
create_basic_wheel_for_package(script, "pkg2", "1.0", extras={"ext": ["pkg1"]})
2188+
create_basic_wheel_for_package(script, "pkg2", "2.0", extras={"ext": ["pkg1"]})
2189+
create_basic_wheel_for_package(script, "pkg3", "1.0", depends=["pkg2[ext]"])
2190+
2191+
# Install pkg3 with an older pkg2.
2192+
script.pip(
2193+
"install",
2194+
"--no-cache-dir",
2195+
"--no-index",
2196+
"--find-links",
2197+
script.scratch_path,
2198+
"pkg3",
2199+
"pkg2==1.0",
2200+
)
2201+
script.assert_installed(pkg3="1.0", pkg2="1.0", pkg1="1.0")
2202+
2203+
# Now upgrade both pkg3 and pkg2. pkg2 should be upgraded although pkg2[ext]
2204+
# is not requested by the user.
2205+
script.pip(
2206+
"install",
2207+
"--no-cache-dir",
2208+
"--no-index",
2209+
"--find-links",
2210+
script.scratch_path,
2211+
"--upgrade",
2212+
"pkg3",
2213+
"pkg2",
2214+
)
2215+
script.assert_installed(pkg3="1.0", pkg2="2.0", pkg1="1.0")

0 commit comments

Comments
 (0)