Add test case for Python selection when invoked with python -m uv --system (#7439)

This commit is contained in:
Zanie Blue 2024-09-16 15:42:06 -05:00 committed by GitHub
parent 6066989ed4
commit d3e6765cea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(
&[