Skip to content

Commit e27af2c

Browse files
add notes on hash mismatch testing
1 parent 20b54de commit e27af2c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/functional/test_fast_deps.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ def test_hash_mismatch(script: PipTestEnvironment, tmp_path: pathlib.Path) -> No
106106

107107

108108
@mark.network
109-
def test_hash_mismatch_existing_download(
109+
def test_hash_mismatch_existing_download_for_metadata_only_wheel(
110110
script: PipTestEnvironment, tmp_path: pathlib.Path
111111
) -> None:
112+
"""Metadata-only wheels from PEP 658 or fast-deps check for hash matching in
113+
a separate code path than when the wheel is downloaded all at once. Make sure we
114+
still check for hash mismatches."""
112115
reqs = tmp_path / "requirements.txt"
113116
reqs.write_text("idna==2.10")
114117
dl_dir = tmp_path / "downloads"
@@ -117,6 +120,7 @@ def test_hash_mismatch_existing_download(
117120
idna_wheel.write_text("asdf")
118121
result = script.pip(
119122
"download",
123+
# Ensure that we have a metadata-only dist for idna.
120124
"--use-feature=fast-deps",
121125
"-r",
122126
str(reqs),
@@ -127,6 +131,7 @@ def test_hash_mismatch_existing_download(
127131
assert re.search(
128132
r"WARNING: Previously-downloaded file.*has bad hash", result.stderr
129133
)
134+
# This is the correct hash for idna==2.10.
130135
assert (
131136
hash_file(str(idna_wheel))[0].hexdigest()
132137
== "b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"

0 commit comments

Comments
 (0)