Skip to content

Commit 42a87da

Browse files
authored
Update some Python find tests to use filters (astral-sh#12377)
1 parent 2592e0f commit 42a87da

File tree

1 file changed

+16
-37
lines changed

1 file changed

+16
-37
lines changed

crates/uv/tests/it/python_find.rs

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,18 @@ use crate::common::{uv_snapshot, venv_bin_path, TestContext};
99

1010
#[test]
1111
fn python_find() {
12-
let mut context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"]);
12+
let mut context: TestContext =
13+
TestContext::new_with_versions(&["3.11", "3.12"]).with_filtered_python_sources();
1314

1415
// No interpreters on the path
15-
if cfg!(windows) {
16-
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r###"
17-
success: false
18-
exit_code: 2
19-
----- stdout -----
20-
21-
----- stderr -----
22-
error: No interpreter found in virtual environments, managed installations, search path, or registry
23-
"###);
24-
} else {
25-
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r###"
26-
success: false
27-
exit_code: 2
28-
----- stdout -----
16+
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r"
17+
success: false
18+
exit_code: 2
19+
----- stdout -----
2920
30-
----- stderr -----
31-
error: No interpreter found in virtual environments, managed installations, or search path
32-
"###);
33-
}
21+
----- stderr -----
22+
error: No interpreter found in [PYTHON SOURCES]
23+
");
3424

3525
// We find the first interpreter on the path
3626
uv_snapshot!(context.filters(), context.python_find(), @r###"
@@ -108,25 +98,14 @@ fn python_find() {
10898
"###);
10999

110100
// Request PyPy (which should be missing)
111-
if cfg!(windows) {
112-
uv_snapshot!(context.filters(), context.python_find().arg("pypy"), @r###"
113-
success: false
114-
exit_code: 2
115-
----- stdout -----
116-
117-
----- stderr -----
118-
error: No interpreter found for PyPy in virtual environments, managed installations, search path, or registry
119-
"###);
120-
} else {
121-
uv_snapshot!(context.filters(), context.python_find().arg("pypy"), @r###"
122-
success: false
123-
exit_code: 2
124-
----- stdout -----
101+
uv_snapshot!(context.filters(), context.python_find().arg("pypy"), @r"
102+
success: false
103+
exit_code: 2
104+
----- stdout -----
125105
126-
----- stderr -----
127-
error: No interpreter found for PyPy in virtual environments, managed installations, or search path
128-
"###);
129-
}
106+
----- stderr -----
107+
error: No interpreter found for PyPy in [PYTHON SOURCES]
108+
");
130109

131110
// Swap the order of the Python versions
132111
context.python_versions.reverse();

0 commit comments

Comments
 (0)