Skip to content

Conversation

@TomFryersMidsummer
Copy link

@TomFryersMidsummer TomFryersMidsummer commented Nov 7, 2025

Workspaces don't have their integration tests in tests/ at the root, so this check missed them.

This fixes #11775 for workspaces.

changelog: [mod_module_files]: Fix false positive for integration tests in workspace crates.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 7, 2025

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Workspaces don't have their integration tests in tests/ at the root, so
this check missed them.
@TomFryersMidsummer TomFryersMidsummer force-pushed the workspace-test-mod-module-files branch from a1f9145 to da7bde7 Compare November 7, 2025 13:01
Comment on lines +157 to +158
.take_while(|&c| c != "src")
.any(|c| c == "tests")

Choose a reason for hiding this comment

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

Unless I'm misreading this, it seems like it will work for some-path/nested/crates/my-crate/src/tests/ but not for some-path/crates/my-crate/tests/. (I read this as "find the first src directory and then check that it doesn't have tests in any directory under it")

Copy link
Author

Choose a reason for hiding this comment

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

I think that would be what it would be if I’d used skip_while. My intention here, with take_while, is to ‘find if there’s a tests directory, excluding if it’s under a src directory’.

I think just .any(|c| c == "tests"), without the take_while, would be good enough for almost all cases, but excluding the contents of src seemed like a good way to eliminate a few false positives (for the check, leading to false negatives for the lint).

Choose a reason for hiding this comment

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

You are totally correct - I should have double-checked in the docs, it's been a while since I used take_while and skip_while so I got them mixed up 🤦 Sorry for the confusion!

Copy link

@miguelpduarte miguelpduarte left a comment

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow mod files within tests directory

4 participants