Skip to content

Detect integration tests in is_in_test#16786

Open
ClementTsang wants to merge 4 commits intorust-lang:masterfrom
ClementTsang:allow-unwrap-in-integration-tests
Open

Detect integration tests in is_in_test#16786
ClementTsang wants to merge 4 commits intorust-lang:masterfrom
ClementTsang:allow-unwrap-in-integration-tests

Conversation

@ClementTsang
Copy link
Copy Markdown

@ClementTsang ClementTsang commented Mar 31, 2026

Related: #13981

This PR makes it so that the is_in_test check accounts for if a node is in an integration test file (that is, under tests/). This should fix the issue where some clippy settings work for cfg(test) but not for integration tests.

This could be extended to benches as well if this seems reasonable.


Note that this is the first time I'm contributing to this repo, so please let me know if there's anything to change. I'm not really sure how I was meant to test this for example, especially if I want to test an example of this where it should still "fail", I guess (should I split the integration_test with two crates?).

changelog: [unwrap-used]: allow-unwrap-in-tests works now on integration tests.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 31, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 31, 2026

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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@ClementTsang ClementTsang marked this pull request as draft March 31, 2026 05:51
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 31, 2026
@ClementTsang ClementTsang force-pushed the allow-unwrap-in-integration-tests branch from d96fa88 to e3772c6 Compare March 31, 2026 05:55
@ClementTsang
Copy link
Copy Markdown
Author

Hmmm it looks like it's causing problems because now some of clippy's tests are being treated as valid under is_in_test... let me set this to draft for now and figure this out. For whatever reason I didn't catch this when testing locally earlier.

@ClementTsang ClementTsang force-pushed the allow-unwrap-in-integration-tests branch from 10d22da to 07033e9 Compare April 3, 2026 08:33
@ClementTsang ClementTsang marked this pull request as ready for review April 3, 2026 08:33
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 3, 2026
Seems like the integration test check trips the ui tests, wasn't sure about this or whether I should adjust all the
existing failing tests.
@ClementTsang ClementTsang force-pushed the allow-unwrap-in-integration-tests branch from 4588d65 to d234340 Compare May 7, 2026 04:01
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 7, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

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.

3 participants