Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore workspace root when running pytest #858

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rye/src/cli/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
hyyking marked this conversation as resolved.
Show resolved Hide resolved
all: bool,
/// Perform the operation on a specific package
#[arg(short, long)]
Expand Down Expand Up @@ -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)?;
Expand All @@ -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() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_workspace_root would return true if it was single package so we need to ask for the workspace

continue;
}
if output != CommandOutput::Quiet {
if idx > 0 {
println!();
Expand Down