mirror of https://github.com/astral-sh/uv
Fix the preview warning on `uv workspace dir` (#16775)
This commit is contained in:
parent
3ac43e8d15
commit
fc0cf90795
|
|
@ -20,7 +20,7 @@ pub(crate) async fn dir(
|
||||||
preview: Preview,
|
preview: Preview,
|
||||||
printer: Printer,
|
printer: Printer,
|
||||||
) -> Result<ExitStatus> {
|
) -> Result<ExitStatus> {
|
||||||
if preview.is_enabled(PreviewFeatures::WORKSPACE_DIR) {
|
if !preview.is_enabled(PreviewFeatures::WORKSPACE_DIR) {
|
||||||
warn_user!(
|
warn_user!(
|
||||||
"The `uv workspace dir` command is experimental and may change without warning. Pass `--preview-features {}` to disable this warning.",
|
"The `uv workspace dir` command is experimental and may change without warning. Pass `--preview-features {}` to disable this warning.",
|
||||||
PreviewFeatures::WORKSPACE_DIR
|
PreviewFeatures::WORKSPACE_DIR
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,15 @@ fn workspace_dir_simple() {
|
||||||
|
|
||||||
let workspace = context.temp_dir.child("foo");
|
let workspace = context.temp_dir.child("foo");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.workspace_dir().current_dir(&workspace), @r###"
|
uv_snapshot!(context.filters(), context.workspace_dir().current_dir(&workspace), @r"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
[TEMP_DIR]/foo
|
[TEMP_DIR]/foo
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
"###
|
warning: The `uv workspace dir` command is experimental and may change without warning. Pass `--preview-features workspace-dir` to disable this warning.
|
||||||
|
"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,25 +37,27 @@ fn workspace_dir_specific_package() {
|
||||||
let workspace = context.temp_dir.child("foo");
|
let workspace = context.temp_dir.child("foo");
|
||||||
|
|
||||||
// root workspace
|
// root workspace
|
||||||
uv_snapshot!(context.filters(), context.workspace_dir().current_dir(&workspace), @r###"
|
uv_snapshot!(context.filters(), context.workspace_dir().current_dir(&workspace), @r"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
[TEMP_DIR]/foo
|
[TEMP_DIR]/foo
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
"###
|
warning: The `uv workspace dir` command is experimental and may change without warning. Pass `--preview-features workspace-dir` to disable this warning.
|
||||||
|
"
|
||||||
);
|
);
|
||||||
|
|
||||||
// with --package bar
|
// with --package bar
|
||||||
uv_snapshot!(context.filters(), context.workspace_dir().arg("--package").arg("bar").current_dir(&workspace), @r###"
|
uv_snapshot!(context.filters(), context.workspace_dir().arg("--package").arg("bar").current_dir(&workspace), @r"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
[TEMP_DIR]/foo/bar
|
[TEMP_DIR]/foo/bar
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
"###
|
warning: The `uv workspace dir` command is experimental and may change without warning. Pass `--preview-features workspace-dir` to disable this warning.
|
||||||
|
"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,14 +75,15 @@ fn workspace_metadata_from_member() -> Result<()> {
|
||||||
|
|
||||||
let member_dir = workspace.join("packages").join("bird-feeder");
|
let member_dir = workspace.join("packages").join("bird-feeder");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.workspace_dir().current_dir(&member_dir), @r###"
|
uv_snapshot!(context.filters(), context.workspace_dir().current_dir(&member_dir), @r"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
[TEMP_DIR]/workspace
|
[TEMP_DIR]/workspace
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
"###
|
warning: The `uv workspace dir` command is experimental and may change without warning. Pass `--preview-features workspace-dir` to disable this warning.
|
||||||
|
"
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -95,14 +99,15 @@ fn workspace_dir_package_doesnt_exist() {
|
||||||
|
|
||||||
let workspace = context.temp_dir.child("foo");
|
let workspace = context.temp_dir.child("foo");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.workspace_dir().arg("--package").arg("bar").current_dir(&workspace), @r###"
|
uv_snapshot!(context.filters(), context.workspace_dir().arg("--package").arg("bar").current_dir(&workspace), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
warning: The `uv workspace dir` command is experimental and may change without warning. Pass `--preview-features workspace-dir` to disable this warning.
|
||||||
error: Package `bar` not found in workspace.
|
error: Package `bar` not found in workspace.
|
||||||
"###
|
"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,13 +116,14 @@ fn workspace_dir_package_doesnt_exist() {
|
||||||
fn workspace_metadata_no_project() {
|
fn workspace_metadata_no_project() {
|
||||||
let context = TestContext::new("3.12");
|
let context = TestContext::new("3.12");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.workspace_dir(), @r###"
|
uv_snapshot!(context.filters(), context.workspace_dir(), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
warning: The `uv workspace dir` command is experimental and may change without warning. Pass `--preview-features workspace-dir` to disable this warning.
|
||||||
error: No `pyproject.toml` found in current directory or any parent directory
|
error: No `pyproject.toml` found in current directory or any parent directory
|
||||||
"###
|
"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue