From 59efe06aafe1875ddbb2d797be9c824949ad6a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 2 Jun 2025 09:22:35 +0200 Subject: [PATCH] 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. --- crates/uv/tests/it/init.rs | 14 +++++++------- crates/uv/tests/it/run.rs | 10 +++++----- crates/uv/tests/it/sync.rs | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/uv/tests/it/init.rs b/crates/uv/tests/it/init.rs index 9de718ee7..e9e5e54a7 100644 --- a/crates/uv/tests/it/init.rs +++ b/crates/uv/tests/it/init.rs @@ -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 = [] "### ); diff --git a/crates/uv/tests/it/run.rs b/crates/uv/tests/it/run.rs index d72a258e4..121915ef0 100644 --- a/crates/uv/tests/it/run.rs +++ b/crates/uv/tests/it/run.rs @@ -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#" diff --git a/crates/uv/tests/it/sync.rs b/crates/uv/tests/it/sync.rs index b86ff6c7a..4d3264e01 100644 --- a/crates/uv/tests/it/sync.rs +++ b/crates/uv/tests/it/sync.rs @@ -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#"