mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-30 15:27:24 +00:00
Add test coverage for Python version discovery with prereleases (#6823)
Coverage for https://github.com/astral-sh/uv/pull/6813 — reverting that commit causes the 3.11.0b0 test case to fail.
This commit is contained in:
parent
9ea03ceb38
commit
a17c1e8e40
1 changed files with 52 additions and 0 deletions
|
@ -1849,6 +1849,58 @@ mod tests {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn find_python_all_minors_prerelease() -> Result<()> {
|
||||||
|
let mut context = TestContext::new()?;
|
||||||
|
context.add_python_interpreters(&[
|
||||||
|
(true, ImplementationName::CPython, "python", "3.10.0"),
|
||||||
|
(true, ImplementationName::CPython, "python3", "3.10.0"),
|
||||||
|
(true, ImplementationName::CPython, "python3.11", "3.11.0b0"),
|
||||||
|
])?;
|
||||||
|
|
||||||
|
let python = context.run(|| {
|
||||||
|
find_python_installation(
|
||||||
|
&PythonRequest::parse(">= 3.11"),
|
||||||
|
EnvironmentPreference::Any,
|
||||||
|
PythonPreference::OnlySystem,
|
||||||
|
&context.cache,
|
||||||
|
)
|
||||||
|
})??;
|
||||||
|
assert_eq!(
|
||||||
|
python.interpreter().python_full_version().to_string(),
|
||||||
|
"3.11.0b0",
|
||||||
|
"We should find the 3.11 prerelease even though >=3.11 would normally exclude prereleases"
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn find_python_all_minors_prerelease_next() -> Result<()> {
|
||||||
|
let mut context = TestContext::new()?;
|
||||||
|
context.add_python_interpreters(&[
|
||||||
|
(true, ImplementationName::CPython, "python", "3.10.0"),
|
||||||
|
(true, ImplementationName::CPython, "python3", "3.10.0"),
|
||||||
|
(true, ImplementationName::CPython, "python3.12", "3.12.0b0"),
|
||||||
|
])?;
|
||||||
|
|
||||||
|
let python = context.run(|| {
|
||||||
|
find_python_installation(
|
||||||
|
&PythonRequest::parse(">= 3.11"),
|
||||||
|
EnvironmentPreference::Any,
|
||||||
|
PythonPreference::OnlySystem,
|
||||||
|
&context.cache,
|
||||||
|
)
|
||||||
|
})??;
|
||||||
|
assert_eq!(
|
||||||
|
python.interpreter().python_full_version().to_string(),
|
||||||
|
"3.12.0b0",
|
||||||
|
"We should find the 3.12 prerelease"
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn find_python_pypy_prefers_executable_with_implementation_name() -> Result<()> {
|
fn find_python_pypy_prefers_executable_with_implementation_name() -> Result<()> {
|
||||||
let mut context = TestContext::new()?;
|
let mut context = TestContext::new()?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue