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. /// specifiers verbatim.
#[test] #[test]
fn init_requires_python_specifiers() -> Result<()> { 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"); let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(indoc! { pyproject_toml.write_str(indoc! {
@ -2424,7 +2424,7 @@ fn init_requires_python_specifiers() -> Result<()> {
})?; })?;
let child = context.temp_dir.join("foo"); 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 success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -2445,7 +2445,7 @@ fn init_requires_python_specifiers() -> Result<()> {
version = "0.1.0" version = "0.1.0"
description = "Add your description here" description = "Add your description here"
readme = "README.md" readme = "README.md"
requires-python = "==3.8.*" requires-python = "==3.9.*"
dependencies = [] dependencies = []
"### "###
); );
@ -2456,7 +2456,7 @@ fn init_requires_python_specifiers() -> Result<()> {
filters => context.filters(), filters => context.filters(),
}, { }, {
assert_snapshot!( 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` /// Run `uv init`, inferring the Python version from an existing `.venv`
#[test] #[test]
fn init_existing_environment() -> Result<()> { 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"); let child = context.temp_dir.child("foo");
child.create_dir_all()?; 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` /// Run `uv init`, it should ignore a the Python version from a parent `.venv`
#[test] #[test]
fn init_existing_environment_parent() -> Result<()> { 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 // 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###" 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" version = "0.1.0"
description = "Add your description here" description = "Add your description here"
readme = "README.md" readme = "README.md"
requires-python = ">=3.8" requires-python = ">=3.9"
dependencies = [] 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. /// Ensure that we can import from the root project when layering `--with` requirements.
#[test] #[test]
fn run_isolated_python_version() -> Result<()> { 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"); let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(indoc! { r#" pyproject_toml.write_str(indoc! { r#"
@ -2766,10 +2766,10 @@ fn run_isolated_python_version() -> Result<()> {
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
(3, 8) (3, 9)
----- stderr ----- ----- 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 Creating virtual environment at: .venv
Resolved 6 packages in [TIME] Resolved 6 packages in [TIME]
Prepared 6 packages in [TIME] Prepared 6 packages in [TIME]
@ -2786,7 +2786,7 @@ fn run_isolated_python_version() -> Result<()> {
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
(3, 8) (3, 9)
----- stderr ----- ----- stderr -----
Resolved 6 packages in [TIME] Resolved 6 packages in [TIME]
@ -3281,7 +3281,7 @@ fn run_exit_code() -> Result<()> {
#[test] #[test]
fn run_invalid_project_table() -> Result<()> { 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"); let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(indoc! { r#" pyproject_toml.write_str(indoc! { r#"

View File

@ -8000,7 +8000,7 @@ fn sync_dry_run_and_frozen() -> Result<()> {
#[test] #[test]
fn sync_script() -> Result<()> { 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"); let script = context.temp_dir.child("script.py");
script.write_str(indoc! { r#" script.write_str(indoc! { r#"
@ -8150,7 +8150,7 @@ fn sync_script() -> Result<()> {
#[test] #[test]
fn sync_locked_script() -> Result<()> { 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"); let script = context.temp_dir.child("script.py");
script.write_str(indoc! { r#" script.write_str(indoc! { r#"