Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
di committed May 18, 2021
1 parent e6414d6 commit c772bd9
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/functional/test_new_resolver_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,63 @@ def test_new_resolver_hash_requirement_and_url_constraint_can_fail(
) in result.stderr, str(result)

assert_not_installed(script, "base", "other")


def test_new_resolver_hash_with_extras(script):
parent_with_extra_path = create_basic_wheel_for_package(
script, "parent_with_extra", "0.1.0", depends=["child[extra]"]
)
parent_with_extra_hash = hashlib.sha256(
parent_with_extra_path.read_bytes()
).hexdigest()

parent_without_extra_path = create_basic_wheel_for_package(
script, "parent_without_extra", "0.1.0", depends=["child"]
)
parent_without_extra_hash = hashlib.sha256(
parent_without_extra_path.read_bytes()
).hexdigest()

child_path = create_basic_wheel_for_package(
script, "child", "0.1.0", extras={"extra": ["extra"]}
)
child_hash = hashlib.sha256(child_path.read_bytes()).hexdigest()

# Newer release
create_basic_wheel_for_package(
script, "child", "0.2.0", extras={"extra": ["extra"]}
)

extra_path = create_basic_wheel_for_package(script, "extra", "0.1.0")
extra_hash = hashlib.sha256(extra_path.read_bytes()).hexdigest()

requirements_txt = script.scratch_path / "requirements.txt"
requirements_txt.write_text(
"""
child[extra]==0.1.0 --hash=sha256:{child_hash}
parent_with_extra==0.1.0 --hash=sha256:{parent_with_extra_hash}
parent_without_extra==0.1.0 --hash=sha256:{parent_without_extra_hash}
extra==0.1.0 --hash=sha256:{extra_hash}
""".format(
child_hash=child_hash,
parent_with_extra_hash=parent_with_extra_hash,
parent_without_extra_hash=parent_without_extra_hash,
extra_hash=extra_hash,
),
)

script.pip(
"install",
"--no-cache-dir",
"--no-index",
"--find-links", script.scratch_path,
"--requirement", requirements_txt,
)

assert_installed(
script,
parent_with_extra="0.1.0",
parent_without_extra="0.1.0",
child="0.1.0",
extra="0.1.0",
)

0 comments on commit c772bd9

Please sign in to comment.