-
Notifications
You must be signed in to change notification settings - Fork 179
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
Create a failure test rule #301
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.bzl
as 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_test
attribute? - You need a test for the new test. You'd want to verify that for a target which fails analysis,
analysis_failure_test
succeeds. You'd want to verify that for a target which passes analysis,analysis_failure_test
fails atbazel test
time (not at analysis time). This means you need shell tests which launch bazel (a bit liketests/analysis_test_test.sh
does).
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
d737b3f
to
effb387
Compare
When testing for analysis-phase-failures in rules this rule provides otherwise necessary boilerplate that simply allows to test for correct Error messages
Kind of forgot this PR 🙈 I updated everything to the latest version. Could you please update your review @tetromino ? |
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.