workspace metadata: enable preview warning (#16988)

This commit is contained in:
Zsolt Dollenstein 2025-12-05 10:54:36 +00:00 committed by GitHub
parent f6ad3dcd57
commit 9f58280eb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 17 deletions

View File

@ -55,7 +55,7 @@ pub(crate) async fn metadata(
preview: Preview, preview: Preview,
printer: Printer, printer: Printer,
) -> Result<ExitStatus> { ) -> Result<ExitStatus> {
if preview.is_enabled(PreviewFeatures::WORKSPACE_METADATA) { if !preview.is_enabled(PreviewFeatures::WORKSPACE_METADATA) {
warn_user!( warn_user!(
"The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features {}` to disable this warning.", "The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features {}` to disable this warning.",
PreviewFeatures::WORKSPACE_METADATA PreviewFeatures::WORKSPACE_METADATA

View File

@ -14,7 +14,7 @@ fn workspace_metadata_simple() {
let workspace = context.temp_dir.child("foo"); let workspace = context.temp_dir.child("foo");
uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace), @r###" uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace), @r#"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -32,7 +32,8 @@ fn workspace_metadata_simple() {
} }
----- stderr ----- ----- stderr -----
"### warning: The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features workspace-metadata` to disable this warning.
"#
); );
} }
@ -49,7 +50,7 @@ fn workspace_metadata_root_workspace() -> Result<()> {
&workspace, &workspace,
)?; )?;
uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace), @r###" uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace), @r#"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -75,7 +76,8 @@ fn workspace_metadata_root_workspace() -> Result<()> {
} }
----- stderr ----- ----- stderr -----
"### warning: The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features workspace-metadata` to disable this warning.
"#
); );
Ok(()) Ok(())
@ -94,7 +96,7 @@ fn workspace_metadata_virtual_workspace() -> Result<()> {
&workspace, &workspace,
)?; )?;
uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace), @r###" uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace), @r#"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -120,7 +122,8 @@ fn workspace_metadata_virtual_workspace() -> Result<()> {
} }
----- stderr ----- ----- stderr -----
"### warning: The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features workspace-metadata` to disable this warning.
"#
); );
Ok(()) Ok(())
@ -141,7 +144,7 @@ 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_metadata().current_dir(&member_dir), @r###" uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&member_dir), @r#"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -167,7 +170,8 @@ fn workspace_metadata_from_member() -> Result<()> {
} }
----- stderr ----- ----- stderr -----
"### warning: The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features workspace-metadata` to disable this warning.
"#
); );
Ok(()) Ok(())
@ -198,7 +202,7 @@ fn workspace_metadata_multiple_members() {
.assert() .assert()
.success(); .success();
uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace_root), @r###" uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace_root), @r#"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -224,7 +228,8 @@ fn workspace_metadata_multiple_members() {
} }
----- stderr ----- ----- stderr -----
"### warning: The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features workspace-metadata` to disable this warning.
"#
); );
} }
@ -237,7 +242,7 @@ fn workspace_metadata_single_project() {
let project = context.temp_dir.child("my-project"); let project = context.temp_dir.child("my-project");
uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&project), @r###" uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&project), @r#"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -255,7 +260,8 @@ fn workspace_metadata_single_project() {
} }
----- stderr ----- ----- stderr -----
"### warning: The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features workspace-metadata` to disable this warning.
"#
); );
} }
@ -272,7 +278,7 @@ fn workspace_metadata_with_excluded() -> Result<()> {
&workspace, &workspace,
)?; )?;
uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace), @r###" uv_snapshot!(context.filters(), context.workspace_metadata().current_dir(&workspace), @r#"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -290,7 +296,8 @@ fn workspace_metadata_with_excluded() -> Result<()> {
} }
----- stderr ----- ----- stderr -----
"### warning: The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features workspace-metadata` to disable this warning.
"#
); );
Ok(()) Ok(())
@ -301,13 +308,14 @@ fn workspace_metadata_with_excluded() -> Result<()> {
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_metadata(), @r###" uv_snapshot!(context.filters(), context.workspace_metadata(), @r"
success: false success: false
exit_code: 2 exit_code: 2
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
warning: The `uv workspace metadata` command is experimental and may change without warning. Pass `--preview-features workspace-metadata` 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
"### "
); );
} }