From c9696998876c319aea4a490effdffbd009c7c4d2 Mon Sep 17 00:00:00 2001 From: 1hakusai1 <1hakusai1@gmail.com> Date: Fri, 20 Dec 2024 15:07:27 +0900 Subject: [PATCH 1/3] UV_PYTHON_INSTALL_DIR must be an absolute path in tests --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffc00b4b8a3c..7a36d74a8c55 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ Testing uv requires multiple specific Python versions; they can be installed wit cargo run python install ``` -The storage directory can be configured with `UV_PYTHON_INSTALL_DIR`. +The storage directory can be configured with `UV_PYTHON_INSTALL_DIR`. (It must be an absolute path.) ### Snapshot testing From 2846440d704ac2fd33a5bd93995b51d313d0a5f7 Mon Sep 17 00:00:00 2001 From: 1hakusai1 <1hakusai1@gmail.com> Date: Fri, 20 Dec 2024 15:28:03 +0900 Subject: [PATCH 2/3] Skip a test UV_PYTHON_INSTALL_DIR is set --- crates/uv/tests/it/help.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/uv/tests/it/help.rs b/crates/uv/tests/it/help.rs index 31e3e02d40cc..17bd0f4a704e 100644 --- a/crates/uv/tests/it/help.rs +++ b/crates/uv/tests/it/help.rs @@ -1,3 +1,5 @@ +use std::env; + use crate::common::{uv_snapshot, TestContext}; #[test] @@ -450,6 +452,10 @@ fn help_subcommand() { #[test] fn help_subsubcommand() { + if env::var("UV_PYTHON_INSTALL_DIR").is_ok() { + // skip this test + return; + } let context = TestContext::new_with_versions(&[]); uv_snapshot!(context.filters(), context.help().arg("python").arg("install"), @r###" From 6074ade50f31a2a6a27d05617f3132ab7497fe8f Mon Sep 17 00:00:00 2001 From: 1hakusai1 <1hakusai1@gmail.com> Date: Sat, 21 Dec 2024 12:01:10 +0900 Subject: [PATCH 3/3] Use env_remove instead of skipping the test. --- crates/uv/tests/it/help.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/uv/tests/it/help.rs b/crates/uv/tests/it/help.rs index 17bd0f4a704e..9220022d535b 100644 --- a/crates/uv/tests/it/help.rs +++ b/crates/uv/tests/it/help.rs @@ -1,4 +1,4 @@ -use std::env; +use uv_static::EnvVars; use crate::common::{uv_snapshot, TestContext}; @@ -452,13 +452,9 @@ fn help_subcommand() { #[test] fn help_subsubcommand() { - if env::var("UV_PYTHON_INSTALL_DIR").is_ok() { - // skip this test - return; - } let context = TestContext::new_with_versions(&[]); - uv_snapshot!(context.filters(), context.help().arg("python").arg("install"), @r###" + uv_snapshot!(context.filters(), context.help().env_remove(EnvVars::UV_PYTHON_INSTALL_DIR).arg("python").arg("install"), @r###" success: true exit_code: 0 ----- stdout -----