Skip to content

Commit 0391cbb

Browse files
committed
Add test coverage
1 parent 55b7ad0 commit 0391cbb

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

crates/uv/tests/it/tool_run.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,6 +2049,54 @@ fn tool_run_python_at_version() {
20492049
"###);
20502050
}
20512051

2052+
#[test]
2053+
fn tool_run_hint_version_not_available() {
2054+
let context = TestContext::new_with_versions(&[])
2055+
.with_filtered_counts()
2056+
.with_filtered_python_sources();
2057+
2058+
uv_snapshot!(context.filters(), context.tool_run()
2059+
2060+
.env(EnvVars::UV_PYTHON_DOWNLOADS, "never"), @r"
2061+
success: false
2062+
exit_code: 2
2063+
----- stdout -----
2064+
2065+
----- stderr -----
2066+
error: No interpreter found for Python 3.12 in [PYTHON SOURCES]
2067+
2068+
hint: A managed Python download is available for Python 3.12, but Python downloads are set to 'never'
2069+
");
2070+
2071+
uv_snapshot!(context.filters(), context.tool_run()
2072+
2073+
.env(EnvVars::UV_PYTHON_DOWNLOADS, "auto")
2074+
.env(EnvVars::UV_OFFLINE, "true"), @r"
2075+
success: false
2076+
exit_code: 2
2077+
----- stdout -----
2078+
2079+
----- stderr -----
2080+
error: No interpreter found for Python 3.12 in [PYTHON SOURCES]
2081+
2082+
hint: A managed Python download is available for Python 3.12, but uv is set to offline mode
2083+
");
2084+
2085+
uv_snapshot!(context.filters(), context.tool_run()
2086+
2087+
.env(EnvVars::UV_PYTHON_DOWNLOADS, "auto")
2088+
.env(EnvVars::UV_NO_MANAGED_PYTHON, "true"), @r"
2089+
success: false
2090+
exit_code: 2
2091+
----- stdout -----
2092+
2093+
----- stderr -----
2094+
error: No interpreter found for Python 3.12 in search path
2095+
2096+
hint: A managed Python download is available for Python 3.12, but the Python preference is set to 'only system'
2097+
");
2098+
}
2099+
20522100
#[test]
20532101
fn tool_run_python_from() {
20542102
let context = TestContext::new_with_versions(&["3.12", "3.11"])

0 commit comments

Comments
 (0)