From 1e89d3e44f34b0d9cadbf4dcd8ab05d23c5985d2 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 3 Sep 2024 14:11:23 -0500 Subject: [PATCH] Remove `VIRTUAL_ENV` from project commmands by default (#6976) And use test context helpers for commands consistently. Needed for https://github.com/astral-sh/uv/pull/6864 --- crates/uv/tests/common/mod.rs | 94 +++++++++++++------- crates/uv/tests/pip_check.rs | 18 +--- crates/uv/tests/pip_compile_scenarios.rs | 2 +- crates/uv/tests/pip_freeze.rs | 30 +++---- crates/uv/tests/pip_install_scenarios.rs | 2 +- crates/uv/tests/pip_list.rs | 49 +++++----- crates/uv/tests/pip_show.rs | 30 +++---- scripts/scenarios/templates/compile.mustache | 2 +- scripts/scenarios/templates/install.mustache | 2 +- 9 files changed, 112 insertions(+), 117 deletions(-) diff --git a/crates/uv/tests/common/mod.rs b/crates/uv/tests/common/mod.rs index b948797eb5e2..df2aab4a3647 100644 --- a/crates/uv/tests/common/mod.rs +++ b/crates/uv/tests/common/mod.rs @@ -389,7 +389,7 @@ impl TestContext { /// Create a uv command for testing. pub fn command(&self) -> Command { let mut command = Command::new(get_bin()); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -403,11 +403,10 @@ impl TestContext { /// * Hide other Python python with `UV_PYTHON_INSTALL_DIR` and installed interpreters with /// `UV_TEST_PYTHON_PATH`. /// * Increase the stack size to avoid stack overflows on windows due to large async functions. - pub fn add_shared_args(&self, command: &mut Command) { + pub fn add_shared_args(&self, command: &mut Command, activate_venv: bool) { command .arg("--cache-dir") .arg(self.cache_dir.path()) - .env("VIRTUAL_ENV", self.venv.as_os_str()) .env("UV_NO_WRAP", "1") .env("HOME", self.home_dir.as_os_str()) .env("UV_PYTHON_INSTALL_DIR", "") @@ -415,6 +414,10 @@ impl TestContext { .env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER) .current_dir(self.temp_dir.path()); + if activate_venv { + command.env("VIRTUAL_ENV", self.venv.as_os_str()); + } + if cfg!(all(windows, debug_assertions)) { // TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the // default windows stack of 1MB @@ -426,7 +429,7 @@ impl TestContext { pub fn pip_compile(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("pip").arg("compile"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -434,7 +437,37 @@ impl TestContext { pub fn pip_sync(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("pip").arg("sync"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); + command + } + + pub fn pip_show(&self) -> Command { + let mut command = Command::new(get_bin()); + command.arg("pip").arg("show"); + self.add_shared_args(&mut command, true); + command + } + + /// Create a `pip freeze` command with options shared across scenarios. + pub fn pip_freeze(&self) -> Command { + let mut command = Command::new(get_bin()); + command.arg("pip").arg("freeze"); + self.add_shared_args(&mut command, true); + command + } + + /// Create a `pip check` command with options shared across scenarios. + pub fn pip_check(&self) -> Command { + let mut command = Command::new(get_bin()); + command.arg("pip").arg("check"); + self.add_shared_args(&mut command, true); + command + } + + pub fn pip_list(&self) -> Command { + let mut command = Command::new(get_bin()); + command.arg("pip").arg("list"); + self.add_shared_args(&mut command, true); command } @@ -442,8 +475,7 @@ impl TestContext { pub fn venv(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("venv"); - self.add_shared_args(&mut command); - command.env_remove("VIRTUAL_ENV"); + self.add_shared_args(&mut command, false); command } @@ -451,7 +483,7 @@ impl TestContext { pub fn pip_install(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("pip").arg("install"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -459,7 +491,7 @@ impl TestContext { pub fn pip_uninstall(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("pip").arg("uninstall"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -467,7 +499,7 @@ impl TestContext { pub fn pip_tree(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("pip").arg("tree"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -490,7 +522,7 @@ impl TestContext { pub fn init(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("init"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -498,7 +530,7 @@ impl TestContext { pub fn sync(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("sync"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -506,7 +538,7 @@ impl TestContext { pub fn lock(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("lock"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -514,7 +546,7 @@ impl TestContext { pub fn export(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("export"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -527,7 +559,7 @@ impl TestContext { .env("UV_PREVIEW", "1") .env("UV_PYTHON_INSTALL_DIR", "") .current_dir(&self.temp_dir); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -540,7 +572,7 @@ impl TestContext { .env("UV_PREVIEW", "1") .env("UV_PYTHON_INSTALL_DIR", "") .current_dir(&self.temp_dir); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -548,7 +580,7 @@ impl TestContext { pub fn python_dir(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("python").arg("dir"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -556,7 +588,7 @@ impl TestContext { pub fn run(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("run").env("UV_SHOW_RESOLUTION", "1"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, true); command } @@ -567,7 +599,7 @@ impl TestContext { .arg("tool") .arg("run") .env("UV_SHOW_RESOLUTION", "1"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -575,7 +607,7 @@ impl TestContext { pub fn tool_upgrade(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("tool").arg("upgrade"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -583,7 +615,7 @@ impl TestContext { pub fn tool_install(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("tool").arg("install"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER); command } @@ -592,7 +624,7 @@ impl TestContext { pub fn tool_list(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("tool").arg("list"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -600,7 +632,7 @@ impl TestContext { pub fn tool_dir(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("tool").arg("dir"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -608,7 +640,7 @@ impl TestContext { pub fn tool_uninstall(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("tool").arg("uninstall"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -616,7 +648,7 @@ impl TestContext { pub fn add(&self, reqs: &[&str]) -> Command { let mut command = Command::new(get_bin()); command.arg("add").args(reqs); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -624,7 +656,7 @@ impl TestContext { pub fn add_no_sync(&self, reqs: &[&str]) -> Command { let mut command = Command::new(get_bin()); command.arg("add").arg("--no-sync").args(reqs); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -632,7 +664,7 @@ impl TestContext { pub fn remove(&self, reqs: &[&str]) -> Command { let mut command = Command::new(get_bin()); command.arg("remove").args(reqs); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -640,7 +672,7 @@ impl TestContext { pub fn remove_no_sync(&self, reqs: &[&str]) -> Command { let mut command = Command::new(get_bin()); command.arg("remove").arg("--no-sync").args(reqs); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -648,7 +680,7 @@ impl TestContext { pub fn tree(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("tree"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -656,7 +688,7 @@ impl TestContext { pub fn clean(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("cache").arg("clean"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } @@ -664,7 +696,7 @@ impl TestContext { pub fn prune(&self) -> Command { let mut command = Command::new(get_bin()); command.arg("cache").arg("prune"); - self.add_shared_args(&mut command); + self.add_shared_args(&mut command, false); command } diff --git a/crates/uv/tests/pip_check.rs b/crates/uv/tests/pip_check.rs index 835d3ea5774b..d81463255b4c 100644 --- a/crates/uv/tests/pip_check.rs +++ b/crates/uv/tests/pip_check.rs @@ -1,23 +1,13 @@ -use std::process::Command; - use anyhow::Result; use assert_fs::fixture::FileWriteStr; use assert_fs::fixture::PathChild; use common::uv_snapshot; -use crate::common::{get_bin, TestContext}; +use crate::common::TestContext; mod common; -/// Create a `pip check` command with options shared across scenarios. -fn check_command(context: &TestContext) -> Command { - let mut command = Command::new(get_bin()); - command.arg("pip").arg("check"); - context.add_shared_args(&mut command); - command -} - #[test] fn check_compatible_packages() -> Result<()> { let context = TestContext::new("3.12"); @@ -46,7 +36,7 @@ fn check_compatible_packages() -> Result<()> { "### ); - uv_snapshot!(check_command(&context), @r###" + uv_snapshot!(context.pip_check(), @r###" success: true exit_code: 0 ----- stdout ----- @@ -113,7 +103,7 @@ fn check_incompatible_packages() -> Result<()> { "### ); - uv_snapshot!(check_command(&context), @r###" + uv_snapshot!(context.pip_check(), @r###" success: false exit_code: 1 ----- stdout ----- @@ -185,7 +175,7 @@ fn check_multiple_incompatible_packages() -> Result<()> { "### ); - uv_snapshot!(check_command(&context), @r###" + uv_snapshot!(context.pip_check(), @r###" success: false exit_code: 1 ----- stdout ----- diff --git a/crates/uv/tests/pip_compile_scenarios.rs b/crates/uv/tests/pip_compile_scenarios.rs index f917c13fd92c..8815674ba9a2 100644 --- a/crates/uv/tests/pip_compile_scenarios.rs +++ b/crates/uv/tests/pip_compile_scenarios.rs @@ -33,7 +33,7 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command { .arg(packse_index_url()) .arg("--find-links") .arg(build_vendor_links_url()); - context.add_shared_args(&mut command); + context.add_shared_args(&mut command, true); command.env_remove("UV_EXCLUDE_NEWER"); command.env("UV_TEST_PYTHON_PATH", python_path); diff --git a/crates/uv/tests/pip_freeze.rs b/crates/uv/tests/pip_freeze.rs index a6a845317e56..307e37741361 100644 --- a/crates/uv/tests/pip_freeze.rs +++ b/crates/uv/tests/pip_freeze.rs @@ -1,24 +1,14 @@ #![cfg(all(feature = "python", feature = "pypi"))] -use std::process::Command; - use anyhow::Result; use assert_cmd::prelude::*; use assert_fs::fixture::ChildPath; use assert_fs::prelude::*; -use crate::common::{get_bin, uv_snapshot, TestContext}; +use crate::common::{uv_snapshot, TestContext}; mod common; -/// Create a `pip freeze` command with options shared across scenarios. -fn command(context: &TestContext) -> Command { - let mut command = Command::new(get_bin()); - command.arg("pip").arg("freeze"); - context.add_shared_args(&mut command); - command -} - /// List multiple installed packages in a virtual environment. #[test] fn freeze_many() -> Result<()> { @@ -35,7 +25,7 @@ fn freeze_many() -> Result<()> { .success(); // Run `pip freeze`. - uv_snapshot!(command(&context) + uv_snapshot!(context.pip_freeze() .arg("--strict"), @r###" success: true exit_code: 0 @@ -87,7 +77,7 @@ fn freeze_duplicate() -> Result<()> { )?; // Run `pip freeze`. - uv_snapshot!(context1.filters(), command(&context1).arg("--strict"), @r###" + uv_snapshot!(context1.filters(), context1.pip_freeze().arg("--strict"), @r###" success: true exit_code: 0 ----- stdout ----- @@ -120,7 +110,7 @@ fn freeze_url() -> Result<()> { .success(); // Run `pip freeze`. - uv_snapshot!(command(&context) + uv_snapshot!(context.pip_freeze() .arg("--strict"), @r###" success: true exit_code: 0 @@ -158,7 +148,7 @@ fn freeze_with_editable() -> Result<()> { .success(); // Run `pip freeze`. - uv_snapshot!(context.filters(), command(&context) + uv_snapshot!(context.filters(), context.pip_freeze() .arg("--strict"), @r###" success: true exit_code: 0 @@ -173,7 +163,7 @@ fn freeze_with_editable() -> Result<()> { ); // Exclude editable package. - uv_snapshot!(context.filters(), command(&context) + uv_snapshot!(context.filters(), context.pip_freeze() .arg("--exclude-editable") .arg("--strict"), @r###" success: true @@ -230,7 +220,7 @@ fn freeze_with_egg_info() -> Result<()> { .write_str("")?; // Run `pip freeze`. - uv_snapshot!(context.filters(), command(&context), @r###" + uv_snapshot!(context.filters(), context.pip_freeze(), @r###" success: true exit_code: 0 ----- stdout ----- @@ -283,7 +273,7 @@ fn freeze_with_egg_info_no_py() -> Result<()> { .write_str("")?; // Run `pip freeze`. - uv_snapshot!(context.filters(), command(&context), @r###" + uv_snapshot!(context.filters(), context.pip_freeze(), @r###" success: true exit_code: 0 ----- stdout ----- @@ -320,7 +310,7 @@ fn freeze_with_egg_info_file() -> Result<()> { "})?; // Run `pip freeze`. - uv_snapshot!(context.filters(), command(&context), @r###" + uv_snapshot!(context.filters(), context.pip_freeze(), @r###" success: true exit_code: 0 ----- stdout ----- @@ -358,7 +348,7 @@ Version: 0.22.0 .write_str(target.path().to_str().unwrap())?; // Run `pip freeze`. - uv_snapshot!(context.filters(), command(&context), @r###" + uv_snapshot!(context.filters(), context.pip_freeze(), @r###" success: true exit_code: 0 ----- stdout ----- diff --git a/crates/uv/tests/pip_install_scenarios.rs b/crates/uv/tests/pip_install_scenarios.rs index 48b2735ad922..0c9840ed50e9 100644 --- a/crates/uv/tests/pip_install_scenarios.rs +++ b/crates/uv/tests/pip_install_scenarios.rs @@ -49,7 +49,7 @@ fn command(context: &TestContext) -> Command { .arg(packse_index_url()) .arg("--find-links") .arg(build_vendor_links_url()); - context.add_shared_args(&mut command); + context.add_shared_args(&mut command, true); command.env_remove("UV_EXCLUDE_NEWER"); command } diff --git a/crates/uv/tests/pip_list.rs b/crates/uv/tests/pip_list.rs index 9519a106a9eb..b7db387d3687 100644 --- a/crates/uv/tests/pip_list.rs +++ b/crates/uv/tests/pip_list.rs @@ -1,5 +1,3 @@ -use std::process::Command; - use anyhow::Result; use assert_fs::fixture::ChildPath; use assert_fs::fixture::FileWriteStr; @@ -8,22 +6,15 @@ use assert_fs::prelude::*; use common::uv_snapshot; -use crate::common::{get_bin, TestContext}; +use crate::common::TestContext; mod common; -fn list_command(context: &TestContext) -> Command { - let mut command = Command::new(get_bin()); - command.arg("pip").arg("list"); - context.add_shared_args(&mut command); - command -} - #[test] fn list_empty_columns() { let context = TestContext::new("3.12"); - uv_snapshot!(list_command(&context) + uv_snapshot!(context.pip_list() .arg("--format") .arg("columns"), @r###" success: true @@ -39,7 +30,7 @@ fn list_empty_columns() { fn list_empty_freeze() { let context = TestContext::new("3.12"); - uv_snapshot!(list_command(&context) + uv_snapshot!(context.pip_list() .arg("--format") .arg("freeze"), @r###" success: true @@ -55,7 +46,7 @@ fn list_empty_freeze() { fn list_empty_json() { let context = TestContext::new("3.12"); - uv_snapshot!(list_command(&context) + uv_snapshot!(context.pip_list() .arg("--format") .arg("json"), @r###" success: true @@ -93,7 +84,7 @@ fn list_single_no_editable() -> Result<()> { context.assert_command("import markupsafe").success(); - uv_snapshot!(list_command(&context), @r###" + uv_snapshot!(context.pip_list(), @r###" success: true exit_code: 0 ----- stdout ----- @@ -137,7 +128,7 @@ fn list_editable() { .chain(vec![(r"\-\-\-\-\-\-+.*", "[UNDERLINE]"), (" +", " ")]) .collect::>(); - uv_snapshot!(filters, list_command(&context), @r###" + uv_snapshot!(filters, context.pip_list(), @r###" success: true exit_code: 0 ----- stdout ----- @@ -182,7 +173,7 @@ fn list_editable_only() { .chain(vec![(r"\-\-\-\-\-\-+.*", "[UNDERLINE]"), (" +", " ")]) .collect::>(); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--editable"), @r###" success: true exit_code: 0 @@ -195,7 +186,7 @@ fn list_editable_only() { "### ); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--exclude-editable"), @r###" success: true exit_code: 0 @@ -210,7 +201,7 @@ fn list_editable_only() { "### ); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--editable") .arg("--exclude-editable"), @r###" success: false @@ -256,7 +247,7 @@ fn list_exclude() { .chain(vec![(r"\-\-\-\-\-\-+.*", "[UNDERLINE]"), (" +", " ")]) .collect::>(); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--exclude") .arg("numpy"), @r###" success: true @@ -273,7 +264,7 @@ fn list_exclude() { "### ); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--exclude") .arg("poetry-editable"), @r###" success: true @@ -289,7 +280,7 @@ fn list_exclude() { "### ); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--exclude") .arg("numpy") .arg("--exclude") @@ -338,7 +329,7 @@ fn list_format_json() { .chain(vec![(r"\-\-\-\-\-\-+.*", "[UNDERLINE]"), (" +", " ")]) .collect(); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--format=json"), @r###" success: true exit_code: 0 @@ -349,7 +340,7 @@ fn list_format_json() { "### ); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--format=json") .arg("--editable"), @r###" success: true @@ -361,7 +352,7 @@ fn list_format_json() { "### ); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--format=json") .arg("--exclude-editable"), @r###" success: true @@ -404,7 +395,7 @@ fn list_format_freeze() { .chain(vec![(r"\-\-\-\-\-\-+.*", "[UNDERLINE]"), (" +", " ")]) .collect::>(); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--format=freeze"), @r###" success: true exit_code: 0 @@ -418,7 +409,7 @@ fn list_format_freeze() { "### ); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--format=freeze") .arg("--editable"), @r###" success: true @@ -430,7 +421,7 @@ fn list_format_freeze() { "### ); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--format=freeze") .arg("--exclude-editable"), @r###" success: true @@ -481,7 +472,7 @@ Version: 0.22.0 .chain(vec![(r"\-\-\-\-\-\-+.*", "[UNDERLINE]"), (" +", " ")]) .collect::>(); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--editable"), @r###" success: true exit_code: 0 @@ -524,7 +515,7 @@ Version: 0.1-bulbasaur .chain(vec![(r"\-\-\-\-\-\-+.*", "[UNDERLINE]"), (" +", " ")]) .collect::>(); - uv_snapshot!(filters, list_command(&context) + uv_snapshot!(filters, context.pip_list() .arg("--editable"), @r###" success: false exit_code: 2 diff --git a/crates/uv/tests/pip_show.rs b/crates/uv/tests/pip_show.rs index f49067af7fd3..4322d1e27972 100644 --- a/crates/uv/tests/pip_show.rs +++ b/crates/uv/tests/pip_show.rs @@ -1,5 +1,4 @@ use std::env::current_dir; -use std::process::Command; use anyhow::Result; use assert_cmd::prelude::*; @@ -9,22 +8,15 @@ use indoc::indoc; use common::uv_snapshot; -use crate::common::{get_bin, TestContext}; +use crate::common::TestContext; mod common; -fn show_command(context: &TestContext) -> Command { - let mut command = Command::new(get_bin()); - command.arg("pip").arg("show"); - context.add_shared_args(&mut command); - command -} - #[test] fn show_empty() { let context = TestContext::new("3.12"); - uv_snapshot!(show_command(&context), @r###" + uv_snapshot!(context.pip_show(), @r###" success: false exit_code: 1 ----- stdout ----- @@ -64,7 +56,7 @@ fn show_requires_multiple() -> Result<()> { ); context.assert_command("import requests").success(); - uv_snapshot!(context.filters(), show_command(&context) + uv_snapshot!(context.filters(), context.pip_show() .arg("requests"), @r###" success: true exit_code: 0 @@ -115,7 +107,7 @@ fn show_python_version_marker() -> Result<()> { filters.push(("Requires: colorama", "Requires:")); } - uv_snapshot!(filters, show_command(&context) + uv_snapshot!(filters, context.pip_show() .arg("click"), @r###" success: true exit_code: 0 @@ -159,7 +151,7 @@ fn show_found_single_package() -> Result<()> { context.assert_command("import markupsafe").success(); - uv_snapshot!(context.filters(), show_command(&context) + uv_snapshot!(context.filters(), context.pip_show() .arg("markupsafe"), @r###" success: true exit_code: 0 @@ -208,7 +200,7 @@ fn show_found_multiple_packages() -> Result<()> { context.assert_command("import markupsafe").success(); - uv_snapshot!(context.filters(), show_command(&context) + uv_snapshot!(context.filters(), context.pip_show() .arg("markupsafe") .arg("pip"), @r###" success: true @@ -264,7 +256,7 @@ fn show_found_one_out_of_three() -> Result<()> { context.assert_command("import markupsafe").success(); - uv_snapshot!(context.filters(), show_command(&context) + uv_snapshot!(context.filters(), context.pip_show() .arg("markupsafe") .arg("flask") .arg("django"), @r###" @@ -317,7 +309,7 @@ fn show_found_one_out_of_two_quiet() -> Result<()> { context.assert_command("import markupsafe").success(); // Flask isn't installed, but markupsafe is, so the command should succeed. - uv_snapshot!(show_command(&context) + uv_snapshot!(context.pip_show() .arg("markupsafe") .arg("flask") .arg("--quiet"), @r###" @@ -364,7 +356,7 @@ fn show_empty_quiet() -> Result<()> { context.assert_command("import markupsafe").success(); // Flask isn't installed, so the command should fail. - uv_snapshot!(show_command(&context) + uv_snapshot!(context.pip_show() .arg("flask") .arg("--quiet"), @r###" success: false @@ -395,7 +387,7 @@ fn show_editable() -> Result<()> { .assert() .success(); - uv_snapshot!(context.filters(), show_command(&context) + uv_snapshot!(context.filters(), context.pip_show() .arg("poetry-editable"), @r###" success: true exit_code: 0 @@ -451,7 +443,7 @@ fn show_required_by_multiple() -> Result<()> { context.assert_command("import requests").success(); // idna is required by anyio and requests - uv_snapshot!(context.filters(), show_command(&context) + uv_snapshot!(context.filters(), context.pip_show() .arg("idna"), @r###" success: true exit_code: 0 diff --git a/scripts/scenarios/templates/compile.mustache b/scripts/scenarios/templates/compile.mustache index 5e47def104db..1041d861606e 100644 --- a/scripts/scenarios/templates/compile.mustache +++ b/scripts/scenarios/templates/compile.mustache @@ -30,7 +30,7 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command { .arg(packse_index_url()) .arg("--find-links") .arg(build_vendor_links_url()); - context.add_shared_args(&mut command); + context.add_shared_args(&mut command, true); command.env_remove("UV_EXCLUDE_NEWER"); command.env("UV_TEST_PYTHON_PATH", python_path); diff --git a/scripts/scenarios/templates/install.mustache b/scripts/scenarios/templates/install.mustache index 2f2153a91efe..2de0f729820a 100644 --- a/scripts/scenarios/templates/install.mustache +++ b/scripts/scenarios/templates/install.mustache @@ -50,7 +50,7 @@ fn command(context: &TestContext) -> Command { .arg(packse_index_url()) .arg("--find-links") .arg(build_vendor_links_url()); - context.add_shared_args(&mut command); + context.add_shared_args(&mut command, true); command.env_remove("UV_EXCLUDE_NEWER"); command }