Update more tests not to use Python 3.8 (#13755)

## Summary

Update a few more tests to avoid using Python 3.8 unnecessarily. From
what I can see, neither of these really need that specific Python
version, so just update them to use 3.9 instead.

Bug #13676

## Test Plan

Uninstall Python 3.8 and run: `cargo test --no-default-features
--features git,pypi,python`

One test failure remains.
This commit is contained in:
Michał Górny 2025-06-02 09:22:35 +02:00 committed by GitHub
parent 9423f05ca7
commit 59efe06aaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 14 deletions

View file

@ -2408,7 +2408,7 @@ fn init_requires_python_version() -> Result<()> {
/// specifiers verbatim.
#[test]
fn init_requires_python_specifiers() -> Result<()> {
let context = TestContext::new_with_versions(&["3.8", "3.12"]);
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(indoc! {
@ -2424,7 +2424,7 @@ fn init_requires_python_specifiers() -> Result<()> {
})?;
let child = context.temp_dir.join("foo");
uv_snapshot!(context.filters(), context.init().current_dir(&context.temp_dir).arg(&child).arg("--python").arg("==3.8.*"), @r###"
uv_snapshot!(context.filters(), context.init().current_dir(&context.temp_dir).arg(&child).arg("--python").arg("==3.9.*"), @r###"
success: true
exit_code: 0
----- stdout -----
@ -2445,7 +2445,7 @@ fn init_requires_python_specifiers() -> Result<()> {
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = "==3.8.*"
requires-python = "==3.9.*"
dependencies = []
"###
);
@ -2456,7 +2456,7 @@ fn init_requires_python_specifiers() -> Result<()> {
filters => context.filters(),
}, {
assert_snapshot!(
python_version, @"3.8"
python_version, @"3.9"
);
});
@ -2503,7 +2503,7 @@ fn init_requires_python_version_file() -> Result<()> {
/// Run `uv init`, inferring the Python version from an existing `.venv`
#[test]
fn init_existing_environment() -> Result<()> {
let context = TestContext::new_with_versions(&["3.8", "3.12"]);
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
let child = context.temp_dir.child("foo");
child.create_dir_all()?;
@ -2552,7 +2552,7 @@ fn init_existing_environment() -> Result<()> {
/// Run `uv init`, it should ignore a the Python version from a parent `.venv`
#[test]
fn init_existing_environment_parent() -> Result<()> {
let context = TestContext::new_with_versions(&["3.8", "3.12"]);
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
// Create a new virtual environment in the parent directory
uv_snapshot!(context.filters(), context.venv().current_dir(&context.temp_dir).arg("--python").arg("3.12"), @r###"
@ -2588,7 +2588,7 @@ fn init_existing_environment_parent() -> Result<()> {
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = []
"###
);

View file

@ -2732,7 +2732,7 @@ fn run_without_output() -> Result<()> {
/// Ensure that we can import from the root project when layering `--with` requirements.
#[test]
fn run_isolated_python_version() -> Result<()> {
let context = TestContext::new_with_versions(&["3.8", "3.12"]);
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(indoc! { r#"
@ -2766,10 +2766,10 @@ fn run_isolated_python_version() -> Result<()> {
success: true
exit_code: 0
----- stdout -----
(3, 8)
(3, 9)
----- stderr -----
Using CPython 3.8.[X] interpreter at: [PYTHON-3.8]
Using CPython 3.9.[X] interpreter at: [PYTHON-3.9]
Creating virtual environment at: .venv
Resolved 6 packages in [TIME]
Prepared 6 packages in [TIME]
@ -2786,7 +2786,7 @@ fn run_isolated_python_version() -> Result<()> {
success: true
exit_code: 0
----- stdout -----
(3, 8)
(3, 9)
----- stderr -----
Resolved 6 packages in [TIME]
@ -3281,7 +3281,7 @@ fn run_exit_code() -> Result<()> {
#[test]
fn run_invalid_project_table() -> Result<()> {
let context = TestContext::new_with_versions(&["3.12", "3.11", "3.8"]);
let context = TestContext::new_with_versions(&["3.12"]);
let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(indoc! { r#"

View file

@ -8000,7 +8000,7 @@ fn sync_dry_run_and_frozen() -> Result<()> {
#[test]
fn sync_script() -> Result<()> {
let context = TestContext::new_with_versions(&["3.8", "3.12"]);
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
let script = context.temp_dir.child("script.py");
script.write_str(indoc! { r#"
@ -8150,7 +8150,7 @@ fn sync_script() -> Result<()> {
#[test]
fn sync_locked_script() -> Result<()> {
let context = TestContext::new_with_versions(&["3.8", "3.12"]);
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
let script = context.temp_dir.child("script.py");
script.write_str(indoc! { r#"