diff options
author | Stéphane Bidoul <stephane.bidoul@gmail.com> | 2023-04-11 14:48:26 +0200 |
---|---|---|
committer | Stéphane Bidoul <stephane.bidoul@gmail.com> | 2023-04-11 14:49:30 +0200 |
commit | cdd9c95eacd58237f8dd800aa40756f9cf8e9b81 (patch) | |
tree | dad528f24410f9e45cf8f0a0f2866a967b2391d9 /tests | |
parent | 55f1251fa28ba69876f33e8a917dc17cee1b7995 (diff) | |
download | pip-cdd9c95eacd58237f8dd800aa40756f9cf8e9b81.tar.gz |
Add test for download_info hashes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/test_install_report.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/functional/test_install_report.py b/tests/functional/test_install_report.py index 83f5b5c2c..4560fc9e7 100644 --- a/tests/functional/test_install_report.py +++ b/tests/functional/test_install_report.py @@ -93,6 +93,39 @@ def test_install_report_index(script: PipTestEnvironment, tmp_path: Path) -> Non @pytest.mark.network +def test_install_report_direct_archive( + script: PipTestEnvironment, tmp_path: Path, shared_data: TestData +) -> None: + """Test report for direct URL archive.""" + report_path = tmp_path / "report.json" + script.pip( + "install", + str(shared_data.root / "packages" / "simplewheel-1.0-py2.py3-none-any.whl"), + "--dry-run", + "--no-index", + "--report", + str(report_path), + ) + report = json.loads(report_path.read_text()) + assert "install" in report + assert len(report["install"]) == 1 + simplewheel_report = _install_dict(report)["simplewheel"] + assert simplewheel_report["metadata"]["name"] == "simplewheel" + assert simplewheel_report["requested"] is True + assert simplewheel_report["is_direct"] is True + url = simplewheel_report["download_info"]["url"] + assert url.startswith("file://") + assert url.endswith("/packages/simplewheel-1.0-py2.py3-none-any.whl") + assert ( + simplewheel_report["download_info"]["archive_info"]["hash"] + == "sha256=e63aa139caee941ec7f33f057a5b987708c2128238357cf905429846a2008718" + ) + assert simplewheel_report["download_info"]["archive_info"]["hashes"] == { + "sha256": "e63aa139caee941ec7f33f057a5b987708c2128238357cf905429846a2008718" + } + + +@pytest.mark.network def test_install_report_vcs_and_wheel_cache( script: PipTestEnvironment, tmp_path: Path ) -> None: |