-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn when --upgrade is passed to tool run
- Loading branch information
1 parent
15dfb66
commit fd49d02
Showing
3 changed files
with
43 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -373,25 +373,6 @@ fn tool_run_from_install() { | |
+ platformdirs==4.2.0 | ||
"###); | ||
|
||
// Verify that `--upgrade` resolves a fresh isolated environment (but reuses the cached | ||
// environment resolved in the previous step). | ||
uv_snapshot!(context.filters(), context.tool_run() | ||
.arg("--upgrade") | ||
.arg("black") | ||
.arg("--version") | ||
.env("UV_TOOL_DIR", tool_dir.as_os_str()) | ||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
black, 24.3.0 (compiled: yes) | ||
Python (CPython) 3.12.[X] | ||
----- stderr ----- | ||
warning: `uv tool run` is experimental and may change without warning | ||
Resolved [N] packages in [TIME] | ||
"###); | ||
|
||
// Verify that `tool run black` at a different version installs the new version. | ||
uv_snapshot!(context.filters(), context.tool_run() | ||
.arg("[email protected]") | ||
|
@@ -903,6 +884,37 @@ fn warn_no_executables_found() { | |
"###); | ||
} | ||
|
||
/// Warn when a user passes `--upgrade` to `uv tool run`. | ||
#[test] | ||
fn tool_run_upgrade_warn() { | ||
let context = TestContext::new("3.12").with_filtered_counts(); | ||
let tool_dir = context.temp_dir.child("tools"); | ||
let bin_dir = context.temp_dir.child("bin"); | ||
|
||
uv_snapshot!(context.filters(), context.tool_run() | ||
.arg("--upgrade") | ||
.arg("pytest") | ||
.arg("--version") | ||
.env("UV_TOOL_DIR", tool_dir.as_os_str()) | ||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
pytest 8.1.1 | ||
----- stderr ----- | ||
warning: Tools cannot be upgraded via `uv tool run`; use `uv tool upgrade` to upgrade installed tools, or `uv tool run package@latest` to run the latest version of a tool | ||
warning: `uv tool run` is experimental and may change without warning | ||
Resolved [N] packages in [TIME] | ||
Prepared [N] packages in [TIME] | ||
Installed [N] packages in [TIME] | ||
+ iniconfig==2.0.0 | ||
+ packaging==24.0 | ||
+ pluggy==1.4.0 | ||
+ pytest==8.1.1 | ||
"###); | ||
} | ||
|
||
/// If we fail to resolve the tool, we should include "tool" in the error message. | ||
#[test] | ||
fn tool_run_resolution_error() { | ||
|