mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-16 01:35:00 +00:00
Add test case for Python pre-release versions from VIRTUAL_ENV
(#7437)
This commit is contained in:
parent
5f2e536925
commit
e8899fe7f9
1 changed files with 26 additions and 1 deletions
|
@ -964,7 +964,7 @@ mod tests {
|
|||
#[test]
|
||||
fn find_python_from_active_python() -> Result<()> {
|
||||
let context = TestContext::new()?;
|
||||
let venv = context.tempdir.child(".venv");
|
||||
let venv = context.tempdir.child("some-venv");
|
||||
TestContext::mock_venv(&venv, "3.12.0")?;
|
||||
|
||||
let python =
|
||||
|
@ -985,6 +985,31 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn find_python_from_active_python_prerelease() -> Result<()> {
|
||||
let mut context = TestContext::new()?;
|
||||
context.add_python_versions(&["3.12.0"])?;
|
||||
let venv = context.tempdir.child("some-venv");
|
||||
TestContext::mock_venv(&venv, "3.13.0rc1")?;
|
||||
|
||||
let python =
|
||||
context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.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.0rc1",
|
||||
"We should prefer the active environment"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn find_python_from_conda_prefix() -> Result<()> {
|
||||
let context = TestContext::new()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue