Minor fixups to `uv workspace metadata` (#16692)

This commit is contained in:
Zanie Blue 2025-11-11 14:41:26 -06:00 committed by GitHub
parent 00e2a0e54d
commit 63df2cdfe9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 22 deletions

View File

@ -520,7 +520,7 @@ pub enum Commands {
Build(BuildArgs), Build(BuildArgs),
/// Upload distributions to an index. /// Upload distributions to an index.
Publish(PublishArgs), Publish(PublishArgs),
/// Manage workspaces. /// Inspect uv workspaces.
#[command( #[command(
after_help = "Use `uv help workspace` for more details.", after_help = "Use `uv help workspace` for more details.",
after_long_help = "", after_long_help = "",
@ -6957,8 +6957,9 @@ pub struct WorkspaceNamespace {
#[derive(Subcommand)] #[derive(Subcommand)]
pub enum WorkspaceCommand { pub enum WorkspaceCommand {
/// Display package metadata. /// View metadata about the current workspace.
#[command(hide = true)] ///
/// The output of this command is not yet stable.
Metadata(MetadataArgs), Metadata(MetadataArgs),
/// Display the path of a workspace member. /// Display the path of a workspace member.
/// ///
@ -6966,7 +6967,6 @@ pub enum WorkspaceCommand {
/// The `--package` option can be used to display the path to a workspace member instead. /// The `--package` option can be used to display the path to a workspace member instead.
/// ///
/// If used outside of a workspace, i.e., if a `pyproject.toml` cannot be found, uv will exit with an error. /// If used outside of a workspace, i.e., if a `pyproject.toml` cannot be found, uv will exit with an error.
#[command(hide = true)]
Dir(WorkspaceDirArgs), Dir(WorkspaceDirArgs),
} }

View File

@ -1,23 +1,9 @@
use std::env;
use std::path::PathBuf;
use anyhow::Result; use anyhow::Result;
use assert_cmd::assert::OutputAssertExt; use assert_cmd::assert::OutputAssertExt;
use assert_fs::fixture::PathChild; use assert_fs::fixture::PathChild;
use crate::common::{TestContext, copy_dir_ignore, uv_snapshot}; use crate::common::{TestContext, copy_dir_ignore, uv_snapshot};
fn workspaces_dir() -> PathBuf {
env::current_dir()
.unwrap()
.parent()
.unwrap()
.parent()
.unwrap()
.join("scripts")
.join("workspaces")
}
/// Test basic metadata output for a simple workspace with one member. /// Test basic metadata output for a simple workspace with one member.
#[test] #[test]
fn workspace_metadata_simple() { fn workspace_metadata_simple() {
@ -57,7 +43,9 @@ fn workspace_metadata_root_workspace() -> Result<()> {
let workspace = context.temp_dir.child("workspace"); let workspace = context.temp_dir.child("workspace");
copy_dir_ignore( copy_dir_ignore(
workspaces_dir().join("albatross-root-workspace"), context
.workspace_root
.join("scripts/workspaces/albatross-root-workspace"),
&workspace, &workspace,
)?; )?;
@ -100,7 +88,9 @@ fn workspace_metadata_virtual_workspace() -> Result<()> {
let workspace = context.temp_dir.child("workspace"); let workspace = context.temp_dir.child("workspace");
copy_dir_ignore( copy_dir_ignore(
workspaces_dir().join("albatross-virtual-workspace"), context
.workspace_root
.join("scripts/workspaces/albatross-virtual-workspace"),
&workspace, &workspace,
)?; )?;
@ -143,7 +133,9 @@ fn workspace_metadata_from_member() -> Result<()> {
let workspace = context.temp_dir.child("workspace"); let workspace = context.temp_dir.child("workspace");
copy_dir_ignore( copy_dir_ignore(
workspaces_dir().join("albatross-root-workspace"), context
.workspace_root
.join("scripts/workspaces/albatross-root-workspace"),
&workspace, &workspace,
)?; )?;
@ -274,7 +266,9 @@ fn workspace_metadata_with_excluded() -> Result<()> {
let workspace = context.temp_dir.child("workspace"); let workspace = context.temp_dir.child("workspace");
copy_dir_ignore( copy_dir_ignore(
workspaces_dir().join("albatross-project-in-excluded"), context
.workspace_root
.join("scripts/workspaces/albatross-project-in-excluded"),
&workspace, &workspace,
)?; )?;