-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add reasons to all ignored tests. #10929
Conversation
@ehuss: no appropriate reviewer found, use r? to override |
if requires_reason && explicit_reason.is_none() { | ||
panic!( | ||
"#[cargo_test] with a rule also requires a reason, \ | ||
such as #[cargo_test(nightly, reason = \"needs -Z unstable-thing\")]" | ||
); | ||
} |
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.
Would it make sense to add ignore
to #[cargo_test]
so that it would require a reason?
#[cargo_test(ignore, reason = "broken, need artifact info in index")]
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.
It could, but it wouldn't prevent someone from adding #[ignore]
and would also make it tricky to write conditional ignores, like:
#[cfg_attr(
any(target_env = "msvc", target_vendor = "apple"),
ignore = "--out-dir and examples are currently broken on MSVC and apple"
)]
I wouldn't want to complicate the macro too much, or to have multiple ways of ignoring (#[cargo_test(ignore)]
and #[ignore]
).
For the most part, these ignore reasons are just a convenience. I don't see it critical that they get printed 100% of the time.
I think in my ideal world, tests could be ignored from within the test using code instead of using attributes, which are not well suited for complex conditions.
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.
Looks nice. Thanks for this enhancement!
@bors r+ |
☀️ Test successful - checks-actions |
Update cargo, rls 14 commits in 85b500ccad8cd0b63995fd94a03ddd4b83f7905b..4fd148c47e733770c537efac5220744945d572ef 2022-07-24 21:10:46 +0000 to 2022-08-03 15:03:52 +0000 - Revert "Drop check for mingw32-make." (rust-lang/cargo#10934) - Add reasons to all ignored tests. (rust-lang/cargo#10929) - Grammar fixup unused patch message (rust-lang/cargo#10933) - Always allow hg to be missing on CI. (rust-lang/cargo#10931) - Fix formats_source test requiring rustfmt. (rust-lang/cargo#10918) - Disable scrape_examples_complex_reverse_dependencies (rust-lang/cargo#10921) - Contrib: Add docs on the rustbot ready command (rust-lang/cargo#10916) - Support for negative --jobs parameter, counting backwards from max CPUs (rust-lang/cargo#10844) - Add requirements to cargo_test. (rust-lang/cargo#9892) - Contrib: Document submodule update process (rust-lang/cargo#10913) - Contrib: Add docs on how to use crater (rust-lang/cargo#10912) - Contrib: Document new-release process (rust-lang/cargo#10914) - Override to resolver=1 in published package (rust-lang/cargo#10911) - fix(add): Update the lock file (rust-lang/cargo#10902) 1 commits in fcf1f94c9ab2acc18cfd4368a4aeb38e77da9649..4d8b0a19986a4daab37287a5b5fe2da0775d1873 2022-07-14 17:19:11 +0200 to 2022-08-02 22:34:34 -0400 - Update cargo (rust-lang/rls#1782)
Update cargo, rls 14 commits in 85b500ccad8cd0b63995fd94a03ddd4b83f7905b..4fd148c47e733770c537efac5220744945d572ef 2022-07-24 21:10:46 +0000 to 2022-08-03 15:03:52 +0000 - Revert "Drop check for mingw32-make." (rust-lang/cargo#10934) - Add reasons to all ignored tests. (rust-lang/cargo#10929) - Grammar fixup unused patch message (rust-lang/cargo#10933) - Always allow hg to be missing on CI. (rust-lang/cargo#10931) - Fix formats_source test requiring rustfmt. (rust-lang/cargo#10918) - Disable scrape_examples_complex_reverse_dependencies (rust-lang/cargo#10921) - Contrib: Add docs on the rustbot ready command (rust-lang/cargo#10916) - Support for negative --jobs parameter, counting backwards from max CPUs (rust-lang/cargo#10844) - Add requirements to cargo_test. (rust-lang/cargo#9892) - Contrib: Document submodule update process (rust-lang/cargo#10913) - Contrib: Add docs on how to use crater (rust-lang/cargo#10912) - Contrib: Document new-release process (rust-lang/cargo#10914) - Override to resolver=1 in published package (rust-lang/cargo#10911) - fix(add): Update the lock file (rust-lang/cargo#10902) 1 commits in fcf1f94c9ab2acc18cfd4368a4aeb38e77da9649..4d8b0a19986a4daab37287a5b5fe2da0775d1873 2022-07-14 17:19:11 +0200 to 2022-08-02 22:34:34 -0400 - Update cargo (rust-lang/rls#1782)
Update cargo, rls 14 commits in 85b500ccad8cd0b63995fd94a03ddd4b83f7905b..4fd148c47e733770c537efac5220744945d572ef 2022-07-24 21:10:46 +0000 to 2022-08-03 15:03:52 +0000 - Revert "Drop check for mingw32-make." (rust-lang/cargo#10934) - Add reasons to all ignored tests. (rust-lang/cargo#10929) - Grammar fixup unused patch message (rust-lang/cargo#10933) - Always allow hg to be missing on CI. (rust-lang/cargo#10931) - Fix formats_source test requiring rustfmt. (rust-lang/cargo#10918) - Disable scrape_examples_complex_reverse_dependencies (rust-lang/cargo#10921) - Contrib: Add docs on the rustbot ready command (rust-lang/cargo#10916) - Support for negative --jobs parameter, counting backwards from max CPUs (rust-lang/cargo#10844) - Add requirements to cargo_test. (rust-lang/cargo#9892) - Contrib: Document submodule update process (rust-lang/cargo#10913) - Contrib: Add docs on how to use crater (rust-lang/cargo#10912) - Contrib: Document new-release process (rust-lang/cargo#10914) - Override to resolver=1 in published package (rust-lang/cargo#10911) - fix(add): Update the lock file (rust-lang/cargo#10902) 1 commits in fcf1f94c9ab2acc18cfd4368a4aeb38e77da9649..4d8b0a19986a4daab37287a5b5fe2da0775d1873 2022-07-14 17:19:11 +0200 to 2022-08-02 22:34:34 -0400 - Update cargo (rust-lang/rls#1782)
This adds a reason string to all
#[ignore]
attributes. This will be displayed when running the test (since 1.61), which can help quickly see and identify why tests are being ignored. It looks roughly like: