mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-19 03:28:42 +00:00
Fix shell-specific test snapshots (#16688)
## Summary Two tests were failing when run with `SHELL=fish`: 1. `create_venv_current_working_directory` failed because the "activate" filter didn't apply properly when the venv was in the CWD. This PR fixes the filter. 2. `tool_install_warn_path` failed because the messages are different between fish and bash. This PR hardcodes `SHELL=fish`. ## Test Plan CI
This commit is contained in:
parent
d32cc638d1
commit
c16a5fd630
3 changed files with 15 additions and 5 deletions
|
|
@ -773,8 +773,12 @@ impl TestContext {
|
|||
"Activate with: source $1/[BIN]/activate".to_string(),
|
||||
));
|
||||
filters.push((
|
||||
r"Activate with: source (.*)/bin/activate(?:\.\w+)?".to_string(),
|
||||
"Activate with: source $1/[BIN]/activate".to_string(),
|
||||
r"Activate with: Scripts\\activate".to_string(),
|
||||
"Activate with: source [BIN]/activate".to_string(),
|
||||
));
|
||||
filters.push((
|
||||
r"Activate with: source (.*/|)bin/activate(?:\.\w+)?".to_string(),
|
||||
"Activate with: source $1[BIN]/activate".to_string(),
|
||||
));
|
||||
|
||||
// Filter non-deterministic temporary directory names
|
||||
|
|
@ -892,6 +896,12 @@ impl TestContext {
|
|||
))
|
||||
.unwrap();
|
||||
|
||||
// Ensure the tests aren't sensitive to the running user's shell without forcing
|
||||
// `bash` on Windows
|
||||
if cfg!(not(windows)) {
|
||||
command.env(EnvVars::SHELL, "bash");
|
||||
}
|
||||
|
||||
command
|
||||
// When running the tests in a venv, ignore that venv, otherwise we'll capture warnings.
|
||||
.env_remove(EnvVars::VIRTUAL_ENV)
|
||||
|
|
|
|||
|
|
@ -2848,7 +2848,7 @@ fn tool_install_warn_path() {
|
|||
.arg("black==24.1.1")
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env_remove(EnvVars::PATH), @r###"
|
||||
.env_remove(EnvVars::PATH), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
@ -2865,7 +2865,7 @@ fn tool_install_warn_path() {
|
|||
+ platformdirs==4.2.0
|
||||
Installed 2 executables: black, blackd
|
||||
warning: `[TEMP_DIR]/bin` is not on your PATH. To use installed tools, run `export PATH="[TEMP_DIR]/bin:$PATH"` or `uv tool update-shell`.
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
/// Test installing and reinstalling with an invalid receipt.
|
||||
|
|
|
|||
|
|
@ -1714,7 +1714,7 @@ fn create_venv_current_working_directory() {
|
|||
----- stderr -----
|
||||
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
|
||||
Creating virtual environment at: .
|
||||
Activate with: source bin/activate
|
||||
Activate with: source [BIN]/activate
|
||||
"
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue