From 3bff8d5f795ad5422b76dc4dfdaa759826116a13 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 12 Feb 2024 22:14:38 -0600 Subject: [PATCH] Add scenario coverage for wheels with incompatible ABI and Python tags (#1285) We use - An arbitrary ABI hash: `MMMMMM` (six base64 characters) - An unlikely Jython27 Python tag For cases that are valid but are never going to be available during tests. See https://github.com/zanieb/packse/pull/109 --- crates/puffin/tests/pip_compile_scenarios.rs | 2 +- crates/puffin/tests/pip_install_scenarios.rs | 80 +++++++++++++++++++- scripts/scenarios/update.py | 2 +- 3 files changed, 81 insertions(+), 3 deletions(-) diff --git a/crates/puffin/tests/pip_compile_scenarios.rs b/crates/puffin/tests/pip_compile_scenarios.rs index d015fbba9..5ba4344bd 100644 --- a/crates/puffin/tests/pip_compile_scenarios.rs +++ b/crates/puffin/tests/pip_compile_scenarios.rs @@ -1,7 +1,7 @@ //! DO NOT EDIT //! //! Generated with ./scripts/scenarios/update.py -//! Scenarios from +//! Scenarios from //! #![cfg(all(feature = "python", feature = "pypi"))] diff --git a/crates/puffin/tests/pip_install_scenarios.rs b/crates/puffin/tests/pip_install_scenarios.rs index e45c0bc79..7e9bd94c3 100644 --- a/crates/puffin/tests/pip_install_scenarios.rs +++ b/crates/puffin/tests/pip_install_scenarios.rs @@ -1,7 +1,7 @@ //! DO NOT EDIT //! //! Generated with ./scripts/scenarios/update.py -//! Scenarios from +//! Scenarios from //! #![cfg(all(feature = "python", feature = "pypi"))] @@ -2493,6 +2493,84 @@ fn no_sdist_no_wheels_with_matching_platform() { assert_not_installed(&context.venv, "a_af6bcec1", &context.temp_dir); } +/// no-sdist-no-wheels-with-matching-python +/// +/// No wheels with matching Python tags are available, nor are any source +/// distributions available +/// +/// ```text +/// 40fe677d +/// ├── environment +/// │ └── python3.8 +/// ├── root +/// │ └── requires a +/// │ └── satisfied by a-1.0.0 +/// └── a +/// └── a-1.0.0 +/// ``` +#[test] +fn no_sdist_no_wheels_with_matching_python() { + let context = TestContext::new("3.8"); + + // In addition to the standard filters, swap out package names for more realistic messages + let mut filters = INSTA_FILTERS.to_vec(); + filters.push((r"a-40fe677d", "albatross")); + filters.push((r"-40fe677d", "")); + + puffin_snapshot!(filters, command(&context) + .arg("a-40fe677d") + , @r###" + success: false + exit_code: 1 + ----- stdout ----- + + ----- stderr ----- + × No solution found when resolving dependencies: + ╰─▶ Because there are no versions of albatross and you require albatross, we can conclude that the requirements are unsatisfiable. + "###); + + assert_not_installed(&context.venv, "a_40fe677d", &context.temp_dir); +} + +/// no-sdist-no-wheels-with-matching-abi +/// +/// No wheels with matching ABI tags are available, nor are any source distributions +/// available +/// +/// ```text +/// 8727a9b9 +/// ├── environment +/// │ └── python3.8 +/// ├── root +/// │ └── requires a +/// │ └── satisfied by a-1.0.0 +/// └── a +/// └── a-1.0.0 +/// ``` +#[test] +fn no_sdist_no_wheels_with_matching_abi() { + let context = TestContext::new("3.8"); + + // In addition to the standard filters, swap out package names for more realistic messages + let mut filters = INSTA_FILTERS.to_vec(); + filters.push((r"a-8727a9b9", "albatross")); + filters.push((r"-8727a9b9", "")); + + puffin_snapshot!(filters, command(&context) + .arg("a-8727a9b9") + , @r###" + success: false + exit_code: 1 + ----- stdout ----- + + ----- stderr ----- + × No solution found when resolving dependencies: + ╰─▶ Because there are no versions of albatross and you require albatross, we can conclude that the requirements are unsatisfiable. + "###); + + assert_not_installed(&context.venv, "a_8727a9b9", &context.temp_dir); +} + /// no-wheels-no-build /// /// No wheels are available, only source distributions but the user has disabled diff --git a/scripts/scenarios/update.py b/scripts/scenarios/update.py index 374da89ea..91d85b4a0 100755 --- a/scripts/scenarios/update.py +++ b/scripts/scenarios/update.py @@ -45,7 +45,7 @@ import textwrap from pathlib import Path -PACKSE_COMMIT = "a2c483f055f5cb01fbbbcf9189c238ee487a7a8e" +PACKSE_COMMIT = "c35c57f5b4ab3381658661edbd0cd955680f9cda" TOOL_ROOT = Path(__file__).parent TEMPLATES = TOOL_ROOT / "templates" INSTALL_TEMPLATE = TEMPLATES / "install.mustache"