From 30c995ac6a3abad99fdc42b21970f6e13c210be1 Mon Sep 17 00:00:00 2001 From: konstin Date: Fri, 9 Aug 2024 10:56:52 +0200 Subject: [PATCH] Update packse to 0.3.34 Preparation for #5905 --- crates/uv/tests/common/mod.rs | 2 +- crates/uv/tests/lock_scenarios.rs | 115 ++++++++++++++++++++++- crates/uv/tests/pip_compile_scenarios.rs | 2 +- crates/uv/tests/pip_install_scenarios.rs | 2 +- scripts/scenarios/requirements.in | 2 +- scripts/scenarios/requirements.txt | 2 +- 6 files changed, 119 insertions(+), 6 deletions(-) diff --git a/crates/uv/tests/common/mod.rs b/crates/uv/tests/common/mod.rs index 4dfdfc40e34c..02dbab979e2c 100644 --- a/crates/uv/tests/common/mod.rs +++ b/crates/uv/tests/common/mod.rs @@ -26,7 +26,7 @@ use uv_python::{ // Exclude any packages uploaded after this date. static EXCLUDE_NEWER: &str = "2024-03-25T00:00:00Z"; -pub const PACKSE_VERSION: &str = "0.3.32"; +pub const PACKSE_VERSION: &str = "0.3.34"; /// Using a find links url allows using `--index-url` instead of `--extra-index-url` in tests /// to prevent dependency confusion attacks against our test suite. diff --git a/crates/uv/tests/lock_scenarios.rs b/crates/uv/tests/lock_scenarios.rs index f2b8517dc383..7141a4abfdc3 100644 --- a/crates/uv/tests/lock_scenarios.rs +++ b/crates/uv/tests/lock_scenarios.rs @@ -1,7 +1,7 @@ //! DO NOT EDIT //! //! Generated with `./scripts/sync_scenarios.sh` -//! Scenarios from +//! Scenarios from //! #![cfg(all(feature = "python", feature = "pypi"))] #![allow(clippy::needless_raw_string_hashes)] @@ -685,6 +685,119 @@ fn fork_filter_sibling_dependencies() -> Result<()> { Ok(()) } +/// This test checks that we discard fork markers when using `--upgrade`. +/// +/// ```text +/// fork-upgrade +/// ├── environment +/// │ └── python3.8 +/// ├── root +/// │ └── requires foo +/// │ ├── satisfied by foo-1.0.0 +/// │ └── satisfied by foo-2.0.0 +/// ├── bar +/// │ ├── bar-1.0.0 +/// │ └── bar-2.0.0 +/// └── foo +/// ├── foo-1.0.0 +/// │ ├── requires bar==1; sys_platform == "linux" +/// │ │ └── satisfied by bar-1.0.0 +/// │ └── requires bar==2; sys_platform != "linux" +/// │ └── satisfied by bar-2.0.0 +/// └── foo-2.0.0 +/// └── requires bar==2 +/// └── satisfied by bar-2.0.0 +/// ``` +#[test] +fn fork_upgrade() -> Result<()> { + let context = TestContext::new("3.8"); + + // In addition to the standard filters, swap out package names for shorter messages + let mut filters = context.filters(); + filters.push((r"fork-upgrade-", "package-")); + + let pyproject_toml = context.temp_dir.child("pyproject.toml"); + pyproject_toml.write_str( + r###" + [project] + name = "project" + version = "0.1.0" + dependencies = [ + '''fork-upgrade-foo''', + ] + requires-python = ">=3.8" + "###, + )?; + + let mut cmd = context.lock(); + cmd.env_remove("UV_EXCLUDE_NEWER"); + cmd.arg("--index-url").arg(packse_index_url()); + uv_snapshot!(filters, cmd, @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + warning: `uv lock` is experimental and may change without warning + Resolved 3 packages in [TIME] + "### + ); + + let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock"))?; + insta::with_settings!({ + filters => filters, + }, { + assert_snapshot!( + lock, @r###" + version = 1 + requires-python = ">=3.8" + + [[package]] + name = "package-bar" + version = "2.0.0" + source = { registry = "https://astral-sh.github.io/packse/PACKSE_VERSION/simple-html/" } + sdist = { url = "https://astral-sh.github.io/packse/PACKSE_VERSION/files/fork_upgrade_bar-2.0.0.tar.gz", hash = "sha256:2e7b5370d7be19b5af56092a8364a2718a7b8516142a12a95656b82d1b9c8cbc" } + wheels = [ + { url = "https://astral-sh.github.io/packse/PACKSE_VERSION/files/fork_upgrade_bar-2.0.0-py3-none-any.whl", hash = "sha256:d8ce562bf363e849fbf4add170a519b5412ab63e378fb4b7ea290183c77616fc" }, + ] + + [[package]] + name = "package-foo" + version = "2.0.0" + source = { registry = "https://astral-sh.github.io/packse/PACKSE_VERSION/simple-html/" } + dependencies = [ + { name = "package-bar" }, + ] + sdist = { url = "https://astral-sh.github.io/packse/PACKSE_VERSION/files/fork_upgrade_foo-2.0.0.tar.gz", hash = "sha256:77296a92069aa604c7fe1d538cf1698dcdc35b4bc3a4a7b16503d520d871e67e" } + wheels = [ + { url = "https://astral-sh.github.io/packse/PACKSE_VERSION/files/fork_upgrade_foo-2.0.0-py3-none-any.whl", hash = "sha256:f066d0608d24ebdb2c23959810188e2f25947a3b492f1d4402ff203287efaf8a" }, + ] + + [[package]] + name = "project" + version = "0.1.0" + source = { editable = "." } + dependencies = [ + { name = "package-foo" }, + ] + "### + ); + }); + + // Assert the idempotence of `uv lock` + context + .lock() + .env_remove("UV_EXCLUDE_NEWER") + .arg("--index-url") + .arg("https://astral-sh.github.io/packse/0.3.31/simple-html/") + .assert() + .success(); + let lock2 = fs_err::read_to_string(context.temp_dir.join("uv.lock"))?; + assert_eq!(lock2, lock); + + Ok(()) +} + /// The root cause the resolver to fork over `a`, but the markers on the variant /// of `a` don't cover the entire marker space, they are missing Python 3.10. /// Later, we have a dependency this very hole, which we still need to select, diff --git a/crates/uv/tests/pip_compile_scenarios.rs b/crates/uv/tests/pip_compile_scenarios.rs index d2c5af4e9ea9..1e07f1e29b48 100644 --- a/crates/uv/tests/pip_compile_scenarios.rs +++ b/crates/uv/tests/pip_compile_scenarios.rs @@ -1,7 +1,7 @@ //! DO NOT EDIT //! //! Generated with `./scripts/sync_scenarios.sh` -//! Scenarios from +//! Scenarios from //! #![cfg(all(feature = "python", feature = "pypi", unix))] diff --git a/crates/uv/tests/pip_install_scenarios.rs b/crates/uv/tests/pip_install_scenarios.rs index 11e74e7edbaa..0626f1179c23 100644 --- a/crates/uv/tests/pip_install_scenarios.rs +++ b/crates/uv/tests/pip_install_scenarios.rs @@ -1,7 +1,7 @@ //! DO NOT EDIT //! //! Generated with `./scripts/sync_scenarios.sh` -//! Scenarios from +//! Scenarios from //! #![cfg(all(feature = "python", feature = "pypi", unix))] diff --git a/scripts/scenarios/requirements.in b/scripts/scenarios/requirements.in index bc9196ad7234..40b02e45689a 100644 --- a/scripts/scenarios/requirements.in +++ b/scripts/scenarios/requirements.in @@ -1,2 +1,2 @@ chevron-blue -packse>=0.3.32 +packse>=0.3.34 diff --git a/scripts/scenarios/requirements.txt b/scripts/scenarios/requirements.txt index 4658c7cdaa3f..be3a29f889f2 100644 --- a/scripts/scenarios/requirements.txt +++ b/scripts/scenarios/requirements.txt @@ -46,7 +46,7 @@ nh3==0.2.17 # via readme-renderer packaging==24.0 # via hatchling -packse==0.3.32 +packse==0.3.34 # via -r scripts/scenarios/requirements.in pathspec==0.12.1 # via hatchling