From 91b492583d8c03ecf2253abdc9e685672557a209 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 10 Sep 2024 14:23:16 -0400 Subject: [PATCH] Add test cases for finding unsupported versions --- crates/uv/tests/python_find.rs | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/crates/uv/tests/python_find.rs b/crates/uv/tests/python_find.rs index 92ce40053d76..bafdb9fd658b 100644 --- a/crates/uv/tests/python_find.rs +++ b/crates/uv/tests/python_find.rs @@ -390,3 +390,39 @@ fn python_find_venv() { ----- stderr ----- "###); } + +#[cfg(unix)] +#[test] +fn python_find_unsupported_version() { + let context: TestContext = TestContext::new_with_versions(&["3.12"]); + + // Request a low version + uv_snapshot!(context.filters(), context.python_find().arg("3.6"), @r###" + success: false + exit_code: 2 + ----- stdout ----- + + ----- stderr ----- + error: No interpreter found for Python 3.6 in virtual environments or system path + "###); + + // Request a really low version + uv_snapshot!(context.filters(), context.python_find().arg("2.6"), @r###" + success: false + exit_code: 2 + ----- stdout ----- + + ----- stderr ----- + error: No interpreter found for Python 2.6 in virtual environments or system path + "###); + + // Request a future version + uv_snapshot!(context.filters(), context.python_find().arg("4.2"), @r###" + success: false + exit_code: 2 + ----- stdout ----- + + ----- stderr ----- + error: No interpreter found for Python 4.2 in virtual environments or system path + "###); +}