mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-01 20:31:12 +00:00
Add test case for Python pre-release versions from parent interpreter (#7438)
This commit is contained in:
parent
e8899fe7f9
commit
6066989ed4
1 changed files with 33 additions and 0 deletions
|
|
@ -1254,6 +1254,39 @@ mod tests {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn find_python_from_parent_interpreter_prerelease() -> Result<()> {
|
||||||
|
let mut context = TestContext::new()?;
|
||||||
|
context.add_python_versions(&["3.12.0"])?;
|
||||||
|
let parent = context.tempdir.child("python").to_path_buf();
|
||||||
|
TestContext::create_mock_interpreter(
|
||||||
|
&parent,
|
||||||
|
&PythonVersion::from_str("3.13.0rc2").unwrap(),
|
||||||
|
ImplementationName::CPython,
|
||||||
|
// Note we mark this as a system interpreter instead of a virtual environment
|
||||||
|
true,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
let python = context.run_with_vars(
|
||||||
|
&[("UV_INTERNAL__PARENT_INTERPRETER", Some(parent.as_os_str()))],
|
||||||
|
|| {
|
||||||
|
find_python_installation(
|
||||||
|
&PythonRequest::Any,
|
||||||
|
EnvironmentPreference::Any,
|
||||||
|
PythonPreference::OnlySystem,
|
||||||
|
&context.cache,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)??;
|
||||||
|
assert_eq!(
|
||||||
|
python.interpreter().python_full_version().to_string(),
|
||||||
|
"3.13.0rc2",
|
||||||
|
"We should find the parent interpreter"
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn find_python_active_python_skipped_if_system_required() -> Result<()> {
|
fn find_python_active_python_skipped_if_system_required() -> Result<()> {
|
||||||
let mut context = TestContext::new()?;
|
let mut context = TestContext::new()?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue