-
-
Notifications
You must be signed in to change notification settings - Fork 469
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
base: main
Are you sure you want to change the base?
Changes from all commits
75a0d23
93f00db
320bd66
0e4be4e
d0008ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ pub struct Args { | |
#[arg(short, long)] | ||
all: bool, | ||
/// Perform the operation on a specific package | ||
#[arg(short, long)] | ||
#[arg(short, long, conflicts_with = "all")] | ||
package: Vec<String>, | ||
/// 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[..])?; | ||
let projects = locate_projects(project, cmd.all | cmd.package.is_empty(), &cmd.package[..])?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Covers 3 branches in the workspace case:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went by the Although I see your point running pytests at the root directory would collect ANY test file such as exposed in #853 and #893 I see three options:
|
||
|
||
if !pytest.is_file() { | ||
let has_pytest = has_pytest_dependency(&projects)?; | ||
|
@@ -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() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
continue; | ||
} | ||
if output != CommandOutput::Quiet { | ||
if idx > 0 { | ||
println!(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary but I think it makes sense to conflict both