Skip to content

Commit 8f88f98

Browse files
authored
Update packse to 0.3.42 for backtracking test (#10009)
Add the missing test for #9843.
1 parent cb325e2 commit 8f88f98

File tree

6 files changed

+185
-15
lines changed

6 files changed

+185
-15
lines changed

crates/uv/tests/it/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use uv_static::EnvVars;
3232
// Exclude any packages uploaded after this date.
3333
static EXCLUDE_NEWER: &str = "2024-03-25T00:00:00Z";
3434

35-
pub const PACKSE_VERSION: &str = "0.3.39";
35+
pub const PACKSE_VERSION: &str = "0.3.42";
3636

3737
/// Using a find links url allows using `--index-url` instead of `--extra-index-url` in tests
3838
/// to prevent dependency confusion attacks against our test suite.

crates/uv/tests/it/lock_scenarios.rs

Lines changed: 161 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! DO NOT EDIT
22
//!
33
//! Generated with `./scripts/sync_scenarios.sh`
4-
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.39/scenarios>
4+
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.42/scenarios>
55
//!
66
#![cfg(all(feature = "python", feature = "pypi"))]
77
#![allow(clippy::needless_raw_string_hashes)]
@@ -17,6 +17,166 @@ use uv_static::EnvVars;
1717

1818
use crate::common::{packse_index_url, uv_snapshot, TestContext};
1919

20+
/// There are two packages, `a` and `b`. We select `a` with `a==2.0.0` first, and then `b`, but `a==2.0.0` conflicts with all new versions of `b`, so we backtrack through versions of `b`.
21+
///
22+
/// We need to detect this conflict and prioritize `b` over `a` instead of backtracking down to the too old version of `b==1.0.0` that doesn't depend on `a` anymore.
23+
///
24+
/// ```text
25+
/// wrong-backtracking-basic
26+
/// ├── environment
27+
/// │ └── python3.8
28+
/// ├── root
29+
/// │ ├── requires a
30+
/// │ │ ├── satisfied by a-1.0.0
31+
/// │ │ └── satisfied by a-2.0.0
32+
/// │ └── requires b
33+
/// │ ├── satisfied by b-1.0.0
34+
/// │ ├── satisfied by b-2.0.0
35+
/// │ ├── satisfied by b-2.0.1
36+
/// │ ├── satisfied by b-2.0.2
37+
/// │ ├── satisfied by b-2.0.3
38+
/// │ ├── satisfied by b-2.0.4
39+
/// │ ├── satisfied by b-2.0.5
40+
/// │ ├── satisfied by b-2.0.6
41+
/// │ ├── satisfied by b-2.0.7
42+
/// │ ├── satisfied by b-2.0.8
43+
/// │ └── satisfied by b-2.0.9
44+
/// ├── a
45+
/// │ ├── a-1.0.0
46+
/// │ └── a-2.0.0
47+
/// ├── b
48+
/// │ ├── b-1.0.0
49+
/// │ │ └── requires too-old
50+
/// │ │ └── satisfied by too-old-1.0.0
51+
/// │ ├── b-2.0.0
52+
/// │ │ └── requires a==1.0.0
53+
/// │ │ └── satisfied by a-1.0.0
54+
/// │ ├── b-2.0.1
55+
/// │ │ └── requires a==1.0.0
56+
/// │ │ └── satisfied by a-1.0.0
57+
/// │ ├── b-2.0.2
58+
/// │ │ └── requires a==1.0.0
59+
/// │ │ └── satisfied by a-1.0.0
60+
/// │ ├── b-2.0.3
61+
/// │ │ └── requires a==1.0.0
62+
/// │ │ └── satisfied by a-1.0.0
63+
/// │ ├── b-2.0.4
64+
/// │ │ └── requires a==1.0.0
65+
/// │ │ └── satisfied by a-1.0.0
66+
/// │ ├── b-2.0.5
67+
/// │ │ └── requires a==1.0.0
68+
/// │ │ └── satisfied by a-1.0.0
69+
/// │ ├── b-2.0.6
70+
/// │ │ └── requires a==1.0.0
71+
/// │ │ └── satisfied by a-1.0.0
72+
/// │ ├── b-2.0.7
73+
/// │ │ └── requires a==1.0.0
74+
/// │ │ └── satisfied by a-1.0.0
75+
/// │ ├── b-2.0.8
76+
/// │ │ └── requires a==1.0.0
77+
/// │ │ └── satisfied by a-1.0.0
78+
/// │ └── b-2.0.9
79+
/// │ └── requires a==1.0.0
80+
/// │ └── satisfied by a-1.0.0
81+
/// └── too-old
82+
/// └── too-old-1.0.0
83+
/// ```
84+
#[test]
85+
fn wrong_backtracking_basic() -> Result<()> {
86+
let context = TestContext::new("3.8");
87+
88+
// In addition to the standard filters, swap out package names for shorter messages
89+
let mut filters = context.filters();
90+
filters.push((r"wrong-backtracking-basic-", "package-"));
91+
92+
let pyproject_toml = context.temp_dir.child("pyproject.toml");
93+
pyproject_toml.write_str(
94+
r###"
95+
[project]
96+
name = "project"
97+
version = "0.1.0"
98+
dependencies = [
99+
'''wrong-backtracking-basic-a''',
100+
'''wrong-backtracking-basic-b''',
101+
]
102+
requires-python = ">=3.8"
103+
"###,
104+
)?;
105+
106+
let mut cmd = context.lock();
107+
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
108+
cmd.arg("--index-url").arg(packse_index_url());
109+
uv_snapshot!(filters, cmd, @r###"
110+
success: true
111+
exit_code: 0
112+
----- stdout -----
113+
114+
----- stderr -----
115+
Resolved 3 packages in [TIME]
116+
"###
117+
);
118+
119+
let lock = context.read("uv.lock");
120+
insta::with_settings!({
121+
filters => filters,
122+
}, {
123+
assert_snapshot!(
124+
lock, @r###"
125+
version = 1
126+
requires-python = ">=3.8"
127+
128+
[[package]]
129+
name = "project"
130+
version = "0.1.0"
131+
source = { virtual = "." }
132+
dependencies = [
133+
{ name = "package-a" },
134+
{ name = "package-b" },
135+
]
136+
137+
[package.metadata]
138+
requires-dist = [
139+
{ name = "package-a" },
140+
{ name = "package-b" },
141+
]
142+
143+
[[package]]
144+
name = "package-a"
145+
version = "1.0.0"
146+
source = { registry = "https://astral-sh.github.io/packse/PACKSE_VERSION/simple-html/" }
147+
sdist = { url = "https://astral-sh.github.io/packse/PACKSE_VERSION/files/wrong_backtracking_basic_a-1.0.0.tar.gz", hash = "sha256:5251a827291d4e5b7ca11c742df3aa26802cc55442e3f5fc307ff3423b8f9295" }
148+
wheels = [
149+
{ url = "https://astral-sh.github.io/packse/PACKSE_VERSION/files/wrong_backtracking_basic_a-1.0.0-py3-none-any.whl", hash = "sha256:d9a7ee79b176cd36c9db03e36bc3325856dd4fb061aefc6159eecad6e8776e88" },
150+
]
151+
152+
[[package]]
153+
name = "package-b"
154+
version = "2.0.9"
155+
source = { registry = "https://astral-sh.github.io/packse/PACKSE_VERSION/simple-html/" }
156+
dependencies = [
157+
{ name = "package-a" },
158+
]
159+
sdist = { url = "https://astral-sh.github.io/packse/PACKSE_VERSION/files/wrong_backtracking_basic_b-2.0.9.tar.gz", hash = "sha256:a4e95f3f0f0d82cc5f19de6c638f70300da1b5101f1ba70d8814c7fe7e949e20" }
160+
wheels = [
161+
{ url = "https://astral-sh.github.io/packse/PACKSE_VERSION/files/wrong_backtracking_basic_b-2.0.9-py3-none-any.whl", hash = "sha256:bf96af1a69f8c1d1d9c2687cd5d6f023cda56dd77d3f37f3cdd422e2a410541f" },
162+
]
163+
"###
164+
);
165+
});
166+
167+
// Assert the idempotence of `uv lock` when resolving from the lockfile (`--locked`).
168+
context
169+
.lock()
170+
.arg("--locked")
171+
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
172+
.arg("--index-url")
173+
.arg(packse_index_url())
174+
.assert()
175+
.success();
176+
177+
Ok(())
178+
}
179+
20180
/// This test ensures that multiple non-conflicting but also
21181
/// non-overlapping dependency specifications with the same package name
22182
/// are allowed and supported.

crates/uv/tests/it/pip_compile_scenarios.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! DO NOT EDIT
22
//!
33
//! Generated with `./scripts/sync_scenarios.sh`
4-
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.39/scenarios>
4+
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.42/scenarios>
55
//!
66
#![cfg(all(feature = "python", feature = "pypi", unix))]
77

crates/uv/tests/it/pip_install_scenarios.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! DO NOT EDIT
22
//!
33
//! Generated with `./scripts/sync_scenarios.sh`
4-
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.39/scenarios>
4+
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.42/scenarios>
55
//!
66
#![cfg(all(feature = "python", feature = "pypi", unix))]
77

@@ -3021,7 +3021,8 @@ fn package_prereleases_global_boundary() {
30213021
/// │ └── python3.8
30223022
/// ├── root
30233023
/// │ └── requires a<0.2.0a2
3024-
/// │ └── satisfied by a-0.1.0
3024+
/// │ ├── satisfied by a-0.1.0
3025+
/// │ └── satisfied by a-0.2.0a1
30253026
/// └── a
30263027
/// ├── a-0.1.0
30273028
/// ├── a-0.2.0
@@ -3162,7 +3163,8 @@ fn requires_package_prerelease_and_final_any() {
31623163
/// │ ├── requires a
31633164
/// │ │ └── satisfied by a-0.1.0
31643165
/// │ └── requires b>0.0.0a1
3165-
/// │ └── satisfied by b-0.1.0
3166+
/// │ ├── satisfied by b-0.1.0
3167+
/// │ └── satisfied by b-1.0.0a1
31663168
/// ├── a
31673169
/// │ └── a-0.1.0
31683170
/// │ └── requires b>0.1
@@ -3329,7 +3331,15 @@ fn transitive_package_only_prereleases() {
33293331
/// ├── a
33303332
/// │ └── a-1.0.0
33313333
/// │ └── requires c!=2.0.0a5,!=2.0.0a6,!=2.0.0a7,!=2.0.0b1,<2.0.0b5,>1.0.0
3332-
/// │ └── unsatisfied: no matching version
3334+
/// │ ├── satisfied by c-2.0.0a1
3335+
/// │ ├── satisfied by c-2.0.0a2
3336+
/// │ ├── satisfied by c-2.0.0a3
3337+
/// │ ├── satisfied by c-2.0.0a4
3338+
/// │ ├── satisfied by c-2.0.0a8
3339+
/// │ ├── satisfied by c-2.0.0a9
3340+
/// │ ├── satisfied by c-2.0.0b2
3341+
/// │ ├── satisfied by c-2.0.0b3
3342+
/// │ └── satisfied by c-2.0.0b4
33333343
/// ├── b
33343344
/// │ └── b-1.0.0
33353345
/// │ └── requires c<=3.0.0,>=1.0.0

scripts/scenarios/requirements.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ chevron-blue==0.2.1
44
# via
55
# -r scripts/scenarios/requirements.in
66
# packse
7-
hatchling==1.24.2
7+
hatchling==1.27.0
88
# via packse
99
msgspec==0.18.6
1010
# via packse
11-
packaging==24.0
11+
packaging==24.2
1212
# via hatchling
13-
packse==0.3.39
13+
packse==0.3.42
1414
# via -r scripts/scenarios/requirements.in
1515
pathspec==0.12.1
1616
# via hatchling
1717
pluggy==1.5.0
1818
# via hatchling
19-
pyyaml==6.0.1
19+
pyyaml==6.0.2
2020
# via packse
21-
setuptools==69.5.1
21+
setuptools==75.6.0
2222
# via packse
23-
trove-classifiers==2024.4.10
23+
trove-classifiers==2024.10.21.16
2424
# via hatchling
25-
uv==0.4.29
25+
uv==0.5.10
2626
# via packse

scripts/sync_scenarios.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ script_root="$(realpath "$(dirname "$0")")"
2323

2424
cd "$script_root/scenarios"
2525
echo "Setting up a temporary environment..."
26-
uv venv
26+
uv venv -p 3.12
2727

2828
# shellcheck disable=SC1091
2929
source ".venv/bin/activate"

0 commit comments

Comments
 (0)