Skip to content

Commit c772bd9

Browse files
committed
Add failing test
1 parent e6414d6 commit c772bd9

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

tests/functional/test_new_resolver_hashes.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,63 @@ def test_new_resolver_hash_requirement_and_url_constraint_can_fail(
308308
) in result.stderr, str(result)
309309

310310
assert_not_installed(script, "base", "other")
311+
312+
313+
def test_new_resolver_hash_with_extras(script):
314+
parent_with_extra_path = create_basic_wheel_for_package(
315+
script, "parent_with_extra", "0.1.0", depends=["child[extra]"]
316+
)
317+
parent_with_extra_hash = hashlib.sha256(
318+
parent_with_extra_path.read_bytes()
319+
).hexdigest()
320+
321+
parent_without_extra_path = create_basic_wheel_for_package(
322+
script, "parent_without_extra", "0.1.0", depends=["child"]
323+
)
324+
parent_without_extra_hash = hashlib.sha256(
325+
parent_without_extra_path.read_bytes()
326+
).hexdigest()
327+
328+
child_path = create_basic_wheel_for_package(
329+
script, "child", "0.1.0", extras={"extra": ["extra"]}
330+
)
331+
child_hash = hashlib.sha256(child_path.read_bytes()).hexdigest()
332+
333+
# Newer release
334+
create_basic_wheel_for_package(
335+
script, "child", "0.2.0", extras={"extra": ["extra"]}
336+
)
337+
338+
extra_path = create_basic_wheel_for_package(script, "extra", "0.1.0")
339+
extra_hash = hashlib.sha256(extra_path.read_bytes()).hexdigest()
340+
341+
requirements_txt = script.scratch_path / "requirements.txt"
342+
requirements_txt.write_text(
343+
"""
344+
child[extra]==0.1.0 --hash=sha256:{child_hash}
345+
parent_with_extra==0.1.0 --hash=sha256:{parent_with_extra_hash}
346+
parent_without_extra==0.1.0 --hash=sha256:{parent_without_extra_hash}
347+
extra==0.1.0 --hash=sha256:{extra_hash}
348+
""".format(
349+
child_hash=child_hash,
350+
parent_with_extra_hash=parent_with_extra_hash,
351+
parent_without_extra_hash=parent_without_extra_hash,
352+
extra_hash=extra_hash,
353+
),
354+
)
355+
356+
script.pip(
357+
"install",
358+
"--no-cache-dir",
359+
"--no-index",
360+
"--find-links", script.scratch_path,
361+
"--requirement", requirements_txt,
362+
)
363+
364+
assert_installed(
365+
script,
366+
parent_with_extra="0.1.0",
367+
parent_without_extra="0.1.0",
368+
child="0.1.0",
369+
extra="0.1.0",
370+
)

0 commit comments

Comments
 (0)