diff --git a/crates/uv/src/commands/tool/install.rs b/crates/uv/src/commands/tool/install.rs index cd1bfed0c8fa..97f9231c1d06 100644 --- a/crates/uv/src/commands/tool/install.rs +++ b/crates/uv/src/commands/tool/install.rs @@ -293,6 +293,16 @@ pub(crate) async fn install( "Ignored existing environment for `{from}` due to stale Python interpreter", from = from.name.cyan(), ); + // XXX(lucab) + #[cfg(target_os = "windows")] + { + let _ = writeln!( + printer.stderr(), + "Interpreter mismatch: old='{}' vs new='{}'", + old_interpreter.display(), + selected_interpreter.display(), + ); + } } same_executable }); diff --git a/crates/uv/tests/tool_install.rs b/crates/uv/tests/tool_install.rs index 6a3bb07ba8e3..0812d882860a 100644 --- a/crates/uv/tests/tool_install.rs +++ b/crates/uv/tests/tool_install.rs @@ -2215,6 +2215,65 @@ fn tool_install_python_params() { "###); } +// XXX(lucab) +#[test] +fn tool_install_debug_windows_ci() { + let context = TestContext::new_with_versions(&["3.11", "3.12"]) + .with_filtered_counts() + .with_filtered_exe_suffix(); + let tool_dir = context.temp_dir.child("tools"); + let bin_dir = context.temp_dir.child("bin"); + + // Install with managed Python 3.11. + uv_snapshot!(context.filters(), context.tool_install() + .arg("-p") + .arg("3.11") + .arg("--no-python-downloads") + .arg("--python-preference") + .arg("only-system") + .arg("black") + .env("UV_TOOL_DIR", tool_dir.as_os_str()) + .env("XDG_BIN_HOME", bin_dir.as_os_str()) + .env("PATH", bin_dir.as_os_str()), @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + Resolved [N] packages in [TIME] + Prepared [N] packages in [TIME] + Installed [N] packages in [TIME] + + black==24.3.0 + + click==8.1.7 + + mypy-extensions==1.0.0 + + packaging==24.0 + + pathspec==0.12.1 + + platformdirs==4.2.0 + Installed 2 executables: black, blackd + "###); + + // Install with managed Python 3.11 (exact same command). + uv_snapshot!(context.filters(), context.tool_install() + .arg("-p") + .arg("3.11") + .arg("--no-python-downloads") + .arg("--python-preference") + // NOTE(lucab): test does NOT pass with 'managed' (the default) + // NOTE(lucab): test passes with 'only-managed' + .arg("only-system") + .arg("black") + .env("UV_TOOL_DIR", tool_dir.as_os_str()) + .env("XDG_BIN_HOME", bin_dir.as_os_str()) + .env("PATH", bin_dir.as_os_str()), @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + `black` is already installed + "###); +} + /// Test preserving a tool environment when new but incompatible requirements are requested. #[test] fn tool_install_preserve_environment() {