Skip to content

Commit cdd9c95

Browse files
committed
Add test for download_info hashes
1 parent 55f1251 commit cdd9c95

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/functional/test_install_report.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,39 @@ def test_install_report_index(script: PipTestEnvironment, tmp_path: Path) -> Non
9292
assert "requires_dist" in paste_report["metadata"]
9393

9494

95+
@pytest.mark.network
96+
def test_install_report_direct_archive(
97+
script: PipTestEnvironment, tmp_path: Path, shared_data: TestData
98+
) -> None:
99+
"""Test report for direct URL archive."""
100+
report_path = tmp_path / "report.json"
101+
script.pip(
102+
"install",
103+
str(shared_data.root / "packages" / "simplewheel-1.0-py2.py3-none-any.whl"),
104+
"--dry-run",
105+
"--no-index",
106+
"--report",
107+
str(report_path),
108+
)
109+
report = json.loads(report_path.read_text())
110+
assert "install" in report
111+
assert len(report["install"]) == 1
112+
simplewheel_report = _install_dict(report)["simplewheel"]
113+
assert simplewheel_report["metadata"]["name"] == "simplewheel"
114+
assert simplewheel_report["requested"] is True
115+
assert simplewheel_report["is_direct"] is True
116+
url = simplewheel_report["download_info"]["url"]
117+
assert url.startswith("file://")
118+
assert url.endswith("/packages/simplewheel-1.0-py2.py3-none-any.whl")
119+
assert (
120+
simplewheel_report["download_info"]["archive_info"]["hash"]
121+
== "sha256=e63aa139caee941ec7f33f057a5b987708c2128238357cf905429846a2008718"
122+
)
123+
assert simplewheel_report["download_info"]["archive_info"]["hashes"] == {
124+
"sha256": "e63aa139caee941ec7f33f057a5b987708c2128238357cf905429846a2008718"
125+
}
126+
127+
95128
@pytest.mark.network
96129
def test_install_report_vcs_and_wheel_cache(
97130
script: PipTestEnvironment, tmp_path: Path

0 commit comments

Comments
 (0)