From 75a0d238d068ce518976332d594f44a625a8db26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Duret?= Date: Sat, 9 Mar 2024 12:53:49 +0100 Subject: [PATCH 1/3] fix: ignore workspace root when running pytest --- rye/src/cli/test.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rye/src/cli/test.rs b/rye/src/cli/test.rs index 05fe898a3c..71d8977a3f 100644 --- a/rye/src/cli/test.rs +++ b/rye/src/cli/test.rs @@ -83,6 +83,9 @@ pub fn execute(cmd: Args) -> Result<(), Error> { } for (idx, project) in projects.iter().enumerate() { + if project.workspace().is_some() && project.is_workspace_root() { + continue; + } if output != CommandOutput::Quiet { if idx > 0 { println!(); From 93f00db7300ef70e95308c57f05e68fd309712e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Duret?= Date: Sat, 9 Mar 2024 13:03:16 +0100 Subject: [PATCH 2/3] fix: set all to true by default, and overwrite if a package is selected --- rye/src/cli/test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rye/src/cli/test.rs b/rye/src/cli/test.rs index 71d8977a3f..e556ae76ff 100644 --- a/rye/src/cli/test.rs +++ b/rye/src/cli/test.rs @@ -20,7 +20,7 @@ use crate::utils::{CommandOutput, QuietExit}; #[derive(Parser, Debug)] pub struct Args { /// Perform the operation on all packages - #[arg(short, long)] + #[arg(short, long, default_value = "true")] all: bool, /// Perform the operation on a specific package #[arg(short, long)] @@ -67,7 +67,7 @@ pub fn execute(cmd: Args) -> Result<(), Error> { .join("pytest") .with_extension(EXE_EXTENSION); - let projects = locate_projects(project, cmd.all, &cmd.package[..])?; + let projects = locate_projects(project, cmd.all && cmd.package.is_empty(), &cmd.package[..])?; if !pytest.is_file() { let has_pytest = has_pytest_dependency(&projects)?; From 320bd666434203d128b64dfaf81b5f27f486aa07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Duret?= Date: Sun, 10 Mar 2024 13:45:17 +0100 Subject: [PATCH 3/3] fix: conflict project and all search for all by default --- rye/src/cli/test.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rye/src/cli/test.rs b/rye/src/cli/test.rs index e556ae76ff..f54c746e1e 100644 --- a/rye/src/cli/test.rs +++ b/rye/src/cli/test.rs @@ -20,10 +20,10 @@ use crate::utils::{CommandOutput, QuietExit}; #[derive(Parser, Debug)] pub struct Args { /// Perform the operation on all packages - #[arg(short, long, default_value = "true")] + #[arg(short, long)] all: bool, /// Perform the operation on a specific package - #[arg(short, long)] + #[arg(short, long, conflicts_with = "all")] package: Vec, /// Use this pyproject.toml file #[arg(long, value_name = "PYPROJECT_TOML")] @@ -67,7 +67,7 @@ pub fn execute(cmd: Args) -> Result<(), Error> { .join("pytest") .with_extension(EXE_EXTENSION); - let projects = locate_projects(project, cmd.all && cmd.package.is_empty(), &cmd.package[..])?; + let projects = locate_projects(project, cmd.all | cmd.package.is_empty(), &cmd.package[..])?; if !pytest.is_file() { let has_pytest = has_pytest_dependency(&projects)?;