mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-28 02:40:11 +00:00
Show non-critical Python discovery errors if no other interpreter is found (#10716)
Previously, these errors would only be visible in the debug logs as "Skipping bad interpreter ..." which can lead us to making some ridiculous claims like "There is no virtual environment" or "Python is not installed" when really we just failed to query the interpreter for some reason. We show the first error, sort of arbitrarily — but I think it matches user expectation, i.e., this would be the first Python on your PATH. Related to #10713
This commit is contained in:
parent
a62b891e6a
commit
b543881b1b
5 changed files with 39 additions and 11 deletions
|
|
@ -111,7 +111,7 @@ mod tests {
|
|||
|
||||
use crate::{
|
||||
discovery::{
|
||||
find_best_python_installation, find_python_installation, EnvironmentPreference,
|
||||
self, find_best_python_installation, find_python_installation, EnvironmentPreference,
|
||||
},
|
||||
PythonPreference,
|
||||
};
|
||||
|
|
@ -589,11 +589,10 @@ mod tests {
|
|||
PythonPreference::default(),
|
||||
&context.cache,
|
||||
)
|
||||
})?;
|
||||
});
|
||||
assert!(
|
||||
matches!(result, Err(PythonNotFound { .. })),
|
||||
// TODO(zanieb): We could improve the error handling to hint this to the user
|
||||
"If only Python 2 is available, we should not find a python; got {result:?}"
|
||||
matches!(result, Err(discovery::Error::Query(..))),
|
||||
"If only Python 2 is available, we should report the interpreter query error; got {result:?}"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue