diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e14d0f26..92f5b769b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,9 +174,6 @@ jobs: run: rustup show - uses: astral-sh/setup-uv@v3 - with: - version: "latest" - enable-cache: true - name: "Install required Python versions" run: uv python install @@ -223,9 +220,6 @@ jobs: run: rustup show - uses: astral-sh/setup-uv@v3 - with: - version: "latest" - enable-cache: true - name: "Install required Python versions" run: uv python install diff --git a/crates/uv/tests/common/mod.rs b/crates/uv/tests/common/mod.rs index 8549bff69..09f34947f 100644 --- a/crates/uv/tests/common/mod.rs +++ b/crates/uv/tests/common/mod.rs @@ -194,20 +194,6 @@ impl TestContext { self } - /// Ignore `UV_CACHE_DIR` env variable in tests. - #[must_use] - pub fn with_ignore_cache_dir(mut self) -> Self { - self.filters.push(( - r"\[env:[\n\s]* UV_CACHE_DIR=.+\]".to_string(), - "[env: UV_CACHE_DIR=]".to_string(), - )); - // When `--cache-dir` is followed with other options, - // remove it from the text. Since its presence is inconsistent. - self.filters - .push((r"--cache-dir <".to_string(), "<".to_string())); - self - } - /// Discover the path to the XDG state directory. We use this, rather than the OS-specific /// temporary directory, because on macOS (and Windows on GitHub Actions), they involve /// symlinks. (On macOS, the temporary directory is, like `/var/...`, which resolves to @@ -447,6 +433,7 @@ impl TestContext { .env("UV_PYTHON_INSTALL_DIR", "") .env("UV_TEST_PYTHON_PATH", self.python_path()) .env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER) + .env_remove("UV_CACHE_DIR") .current_dir(self.temp_dir.path()); if activate_venv { @@ -543,6 +530,7 @@ impl TestContext { pub fn help(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("help"); + command.env_remove("UV_CACHE_DIR"); if cfg!(all(windows, debug_assertions)) { // TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the diff --git a/crates/uv/tests/help.rs b/crates/uv/tests/help.rs index 39c930e75..32013e59a 100644 --- a/crates/uv/tests/help.rs +++ b/crates/uv/tests/help.rs @@ -4,7 +4,7 @@ mod common; #[test] fn help() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); // The `uv help` command should show the long help message uv_snapshot!(context.filters(), context.help(), @r###" @@ -74,7 +74,7 @@ fn help() { #[test] fn help_flag() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); uv_snapshot!(context.filters(), context.command().arg("--help"), @r###" success: true @@ -141,7 +141,7 @@ fn help_flag() { #[test] fn help_short_flag() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); uv_snapshot!(context.filters(), context.command().arg("-h"), @r###" success: true @@ -208,7 +208,7 @@ fn help_short_flag() { #[test] fn help_subcommand() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); uv_snapshot!(context.filters(), context.help().arg("python"), @r###" success: true @@ -396,7 +396,7 @@ fn help_subcommand() { #[test] fn help_subsubcommand() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); uv_snapshot!(context.filters(), context.help().arg("python").arg("install"), @r###" success: true @@ -564,7 +564,7 @@ fn help_subsubcommand() { #[test] fn help_flag_subcommand() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); uv_snapshot!(context.filters(), context.command().arg("python").arg("--help"), @r###" success: true @@ -620,7 +620,7 @@ fn help_flag_subcommand() { #[test] fn help_flag_subsubcommand() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); uv_snapshot!(context.filters(), context.command().arg("python").arg("install").arg("--help"), @r###" success: true @@ -749,7 +749,7 @@ fn help_unknown_subsubcommand() { #[test] fn help_with_global_option() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); uv_snapshot!(context.filters(), context.help().arg("--no-cache"), @r###" success: true @@ -851,7 +851,7 @@ fn help_with_version() { #[test] fn help_with_no_pager() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); + let context = TestContext::new_with_versions(&[]); // We can't really test whether the --no-pager option works with a snapshot test. // It's still nice to have a test for the option to confirm the option exists. diff --git a/crates/uv/tests/pip_uninstall.rs b/crates/uv/tests/pip_uninstall.rs index ad5cd0e31..5a4b67da3 100644 --- a/crates/uv/tests/pip_uninstall.rs +++ b/crates/uv/tests/pip_uninstall.rs @@ -13,9 +13,10 @@ mod common; #[test] fn no_arguments() { - let context = TestContext::new_with_versions(&[]).with_ignore_cache_dir(); - - uv_snapshot!(context.filters(), context.pip_uninstall(), @r###" + uv_snapshot!(Command::new(get_bin()) + .arg("pip") + .arg("uninstall") + .env_clear(), @r###" success: false exit_code: 2 ----- stdout -----