diff --git a/crates/uv-python/src/lib.rs b/crates/uv-python/src/lib.rs index 4d7392b16..a47e4243d 100644 --- a/crates/uv-python/src/lib.rs +++ b/crates/uv-python/src/lib.rs @@ -1230,6 +1230,27 @@ mod tests { "We should prefer the parent interpreter" ); + // Test with `EnvironmentPreference::OnlySystem` + let python = context.run_with_vars( + &[ + ("UV_INTERNAL__PARENT_INTERPRETER", Some(parent.as_os_str())), + ("VIRTUAL_ENV", Some(venv.as_os_str())), + ], + || { + find_python_installation( + &PythonRequest::Any, + EnvironmentPreference::OnlySystem, + PythonPreference::OnlySystem, + &context.cache, + ) + }, + )??; + assert_eq!( + python.interpreter().python_full_version().to_string(), + "3.12.3", + "We should prefer the system interpreter" + ); + // Test with `EnvironmentPreference::OnlyVirtual` let python = context.run_with_vars( &[