-
Notifications
You must be signed in to change notification settings - Fork 193
Create a failure test rule #301
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
base: main
Are you sure you want to change the base?
Conversation
d3ccd95 to
dbfe808
Compare
|
@brandjon @tetromino Do you have any feedback on this? |
|
Bump :) |
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.
Thank you for the PR. I agree with the idea and the code; I've searched and found a few independent reimplementations of the exact same logic, so I think the new rule would be useful.
My comments are not about the code, but about all the boring parts (wording, documentation, and tests):
- this is not a general failure test rule - it's rule for testing analysis-time failure. Therefore, it should be named
analysis_failure_test(and the file named accordingly)- File docstring should be more clear about this - e.g. something like "A test verifying that another target cannot be analyzed"
- You need a docstring for the rule function and all attributes; you can use
analysis_test.bzlas an example. The docstring must include a usage example. Otherwise, how could a user trying out this rule know that, for instance, they need to set thetarget_under_testattribute? - You need a test for the new test. You'd want to verify that for a target which fails analysis,
analysis_failure_testsucceeds. You'd want to verify that for a target which passes analysis,analysis_failure_testfails atbazel testtime (not at analysis time). This means you need shell tests which launch bazel (a bit liketests/analysis_test_test.shdoes).
Nits:
- Copyright year is 2021 :)
43ce840 to
5d582d6
Compare
|
@tetromino Thanks for the detailed feedback :) |
|
Sorry for very delayed review; I'm on leave. But as for the generated docs problem, I realized that we were using a very old Stardoc release via the (deprecated) Federation repo. We'll fix that by #327 |
c74d27a to
59524ff
Compare
|
@tetromino Sry for the even later reaction :/ I fixed the docs and squashed to commits for a cleaner history |
a119b93 to
4c3ea0b
Compare
effb387 to
e8e6d26
Compare
|
Kind of forgot this PR 🙈 I updated everything to the latest version. Could you please update your review @tetromino ? |
6e0db9b to
54ff534
Compare
|
Bit later, ping @tetromino 😅 |
When testing for analysis-phase-failures in rules this rule provides otherwise necessary boilerplate that simply allows to test for correct Error messages
When testing for analysis-phase-failures in rules this rule provides otherwise necessary boilerplate that simply allows to test for correct Error messages
I discovered this reoccuring rule while testing some of my rules and thougt it might be useful to others as well.