mirror of https://github.com/astral-sh/uv
Update some Python find tests to use filters (#12377)
This commit is contained in:
parent
2592e0ff1a
commit
42a87da857
|
|
@ -9,28 +9,18 @@ use crate::common::{uv_snapshot, venv_bin_path, TestContext};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn python_find() {
|
fn python_find() {
|
||||||
let mut context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"]);
|
let mut context: TestContext =
|
||||||
|
TestContext::new_with_versions(&["3.11", "3.12"]).with_filtered_python_sources();
|
||||||
|
|
||||||
// No interpreters on the path
|
// No interpreters on the path
|
||||||
if cfg!(windows) {
|
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r"
|
||||||
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r###"
|
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
error: No interpreter found in virtual environments, managed installations, search path, or registry
|
error: No interpreter found in [PYTHON SOURCES]
|
||||||
"###);
|
");
|
||||||
} else {
|
|
||||||
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r###"
|
|
||||||
success: false
|
|
||||||
exit_code: 2
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
error: No interpreter found in virtual environments, managed installations, or search path
|
|
||||||
"###);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We find the first interpreter on the path
|
// We find the first interpreter on the path
|
||||||
uv_snapshot!(context.filters(), context.python_find(), @r###"
|
uv_snapshot!(context.filters(), context.python_find(), @r###"
|
||||||
|
|
@ -108,25 +98,14 @@ fn python_find() {
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// Request PyPy (which should be missing)
|
// Request PyPy (which should be missing)
|
||||||
if cfg!(windows) {
|
uv_snapshot!(context.filters(), context.python_find().arg("pypy"), @r"
|
||||||
uv_snapshot!(context.filters(), context.python_find().arg("pypy"), @r###"
|
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
error: No interpreter found for PyPy in virtual environments, managed installations, search path, or registry
|
error: No interpreter found for PyPy in [PYTHON SOURCES]
|
||||||
"###);
|
");
|
||||||
} else {
|
|
||||||
uv_snapshot!(context.filters(), context.python_find().arg("pypy"), @r###"
|
|
||||||
success: false
|
|
||||||
exit_code: 2
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
error: No interpreter found for PyPy in virtual environments, managed installations, or search path
|
|
||||||
"###);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Swap the order of the Python versions
|
// Swap the order of the Python versions
|
||||||
context.python_versions.reverse();
|
context.python_versions.reverse();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue