diff options
author | Dustin Ingram <di@users.noreply.github.com> | 2023-01-27 18:38:07 +0000 |
---|---|---|
committer | Dustin Ingram <di@users.noreply.github.com> | 2023-01-27 18:40:34 +0000 |
commit | 9a331b78011129d881fce33fa41704273075f5e3 (patch) | |
tree | abbf0450fad240a992568751521c3578c93a32b6 | |
parent | e69e265cb7b60fb2dacbbb2ab8fa3baaf24bfe4d (diff) | |
download | pip-fix/9644.tar.gz |
Add an additional failing test low-level depsfix/9644
-rw-r--r-- | tests/functional/test_new_resolver_hashes.py | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/tests/functional/test_new_resolver_hashes.py b/tests/functional/test_new_resolver_hashes.py index 6db2efd0e..ef8c1d490 100644 --- a/tests/functional/test_new_resolver_hashes.py +++ b/tests/functional/test_new_resolver_hashes.py @@ -313,7 +313,7 @@ def test_new_resolver_hash_requirement_and_url_constraint_can_fail( script.assert_not_installed("base", "other") -def test_new_resolver_hash_with_extras(script: PipTestEnvironment) -> None: +def test_new_resolver_hash_with_extras_top_level(script: PipTestEnvironment) -> None: parent_with_extra_path = create_basic_wheel_for_package( script, "parent_with_extra", "0.1.0", depends=["child[extra]"] ) @@ -372,3 +372,73 @@ def test_new_resolver_hash_with_extras(script: PipTestEnvironment) -> None: child="0.1.0", extra="0.1.0", ) + + +def test_new_resolver_hash_with_extras_low_level(script: PipTestEnvironment) -> None: + 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() + + constraints_txt = script.scratch_path / "constraints.txt" + constraints_txt.write_text( + """ + child==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, + ), + ) + requirements_txt = script.scratch_path / "requirements.txt" + requirements_txt.write_text( + """ + parent_with_extra + parent_without_extra + """ + ) + + script.pip( + "install", + "--no-cache-dir", + "--no-index", + "--find-links", + script.scratch_path, + "--constraint", + constraints_txt, + "--requirement", + requirements_txt, + ) + + script.assert_installed( + parent_with_extra="0.1.0", + parent_without_extra="0.1.0", + child="0.1.0", + extra="0.1.0", + ) |