diff --git a/crates/uv-python/src/lib.rs b/crates/uv-python/src/lib.rs index 68ea3c39d..4d7392b16 100644 --- a/crates/uv-python/src/lib.rs +++ b/crates/uv-python/src/lib.rs @@ -1254,6 +1254,39 @@ mod tests { 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] fn find_python_active_python_skipped_if_system_required() -> Result<()> { let mut context = TestContext::new()?;