Skip to content

Commit

Permalink
Add failing test for extra-already-installed case
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Oct 23, 2021
1 parent b160e83 commit c4d9f56
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/functional/test_new_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2180,3 +2180,36 @@ def test_new_resolver_dont_backtrack_on_extra_if_base_constrained(script):
)
assert "pkg-2.0" not in result.stdout, "Should not try 2.0 due to constraint"
script.assert_installed(pkg="1.0", dep="1.0")


def test_new_resolver_respect_user_requested_if_extra_is_installed(script):
create_basic_wheel_for_package(script, "pkg1", "1.0")
create_basic_wheel_for_package(script, "pkg2", "1.0", extras={"ext": ["pkg1"]})
create_basic_wheel_for_package(script, "pkg2", "2.0", extras={"ext": ["pkg1"]})
create_basic_wheel_for_package(script, "pkg3", "1.0", depends=["pkg2[ext]"])

# Install pkg3 with an older pkg2.
script.pip(
"install",
"--no-cache-dir",
"--no-index",
"--find-links",
script.scratch_path,
"pkg3",
"pkg2==1.0",
)
script.assert_installed(pkg3="1.0", pkg2="1.0", pkg1="1.0")

# Now upgrade both pkg3 and pkg2. pkg2 should be upgraded although pkg2[ext]
# is not requested by the user.
script.pip(
"install",
"--no-cache-dir",
"--no-index",
"--find-links",
script.scratch_path,
"--upgrade",
"pkg3",
"pkg2",
)
script.assert_installed(pkg3="1.0", pkg2="2.0", pkg1="1.0")

0 comments on commit c4d9f56

Please sign in to comment.