Uh oh!
There was an error while loading. Please reload this page.
add allow_fail test attribute - #42219
Conversation
rust-highfive
commented
May 25, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @GuillaumeGomez (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
a8ccc4e to
9077e5cComparealexcrichton
commented
May 25, 2017
Thanks for the PR! We’ll periodically check in on it to make sure that @GuillaumeGomez or someone else from the team reviews it soon. |
Mark-Simulacrum
commented
May 25, 2017
Can you give some summary as to what the use cases for this would be? I can't think of anything where a failure would be okay (but not |
GuillaumeGomez
commented
May 26, 2017
I don't see the point of this add actually... :-/ |
This is basically for the same reasons you would set |
Mark-Simulacrum
commented
May 26, 2017
Yeah, that helps understand the reasoning. I think I'm neutral on it then -- I don't think we really need it but would be fine having it. |
GuillaumeGomez
commented
May 26, 2017
I understand the reason but then: why not just use |
pwoolcoc
commented
May 26, 2017
Well, |
GuillaumeGomez
commented
May 26, 2017
Your change is included in rustdoc as well, but in there, it's pretty much useless. Then, for consistency, why not just add |
I find |
GuillaumeGomez
commented
May 26, 2017
That's just completely the opposite of the purpose of a test. I really don't agree with you on this functionality. However, maybe some other people might be interested so let's request opinions. cc @rust-lang/compiler |
aturon
commented
May 26, 2017
@pwoolcoc I've wanted this functionality from time to time, and wouldn't be opposed to seeing it land. @alexcrichton, @brson, @nrc, I imagine you might have opinions also? I'm not really sure whose jurisdiction this falls under, tbh. |
alexcrichton
commented
May 27, 2017
This definitely falls under the category of "I wish we had custom test frameworks" to allow this level of customization, but I don't personally have many thoughts here. I think that the most appropriate owner "team-wise" nowadays is the dev-tools team, but in general libtest needs a lot of love not just in ad-hoc additions but also in overall direction. I would not personally be opposed to landing this, although it would perhaps be nice to do it with a feature gate first. |
Mark-Simulacrum
commented
May 28, 2017
I think a feature gate is a good idea here, too. |
Am I right in inferring from the conversation that the reason that this |
Mark-Simulacrum
commented
May 29, 2017
Yes, that seems correct. |
@pnkfelix you are mostly correct. a test marked |
nikomatsakis
commented
May 30, 2017
There is also, of course, the Usually in this scenario what I do is to write the test so that it passes with the current behavior (e.g., by adding I definitely think a feature-gate would be wise here, not sure how technically hard that would be to implement. I also think we might consider this as a "flag" to the existing |
steveklabnik
commented
May 30, 2017
Some frameworks have a "pending" flag instead; what this does is, run the test, and on a failure, do nothing. On a success, it fails your build and says "hey you thought this was not a real test but it works" |
Mark-Simulacrum
commented
May 30, 2017
That seems very much like a "should-fail" flag; so in that respect we have a pending flag already. |
nagisa
commented
May 31, 2017
To me this sounds like a tag for spurious/wont-fix-just-yet failures. This is not comparable to My primary concern with this feature is that once you add this tag, it is very easy to forget to remove it later (similar applies to Custom testing framework would be great. |
nikomatsakis
commented
Jun 2, 2017
I agree that the primary purpose of |
nrc
commented
Jun 8, 2017
This seems a reasonable thing to add to me, but should definitely be behind a feature gate. I also agree that libtest needs some direction (and some RFC discussion), rather than just ad hoc extensions, but this seems like something that would be useful to experiment with first. |
2109da5 to
a319007CompareThis change allows the user to add an `#[allow_fail]` attribute to tests that will cause the test to compile & run, but if the test fails it will not cause the entire test run to fail. The test output will show the failure, but in yellow instead of red, and also indicate that it was an allowed failure.
a319007 to
0763717Compare0763717 to
8edc3caCompare9de5d52 to
4154f89Comparepwoolcoc
commented
Jun 25, 2017
Ok, I think this is in a good state. |
GuillaumeGomez
commented
Jun 26, 2017
I just thought about something: should we add a warning saying that the |
pwoolcoc
commented
Jun 28, 2017
I'm not sure about that, only because not all the use cases for this are for WIP code. For example, I also use it for some integration tests that contact an external service that is not 100% available. |
GuillaumeGomez
commented
Jun 28, 2017
Can you at least display the result of the fail. For example: Or something along the line. Like that, even if it succeeds; you can get the underlying result. |
pwoolcoc
commented
Jun 28, 2017
It does show the test as "test allowed_to_fail ... FAILED (allowed)", but I'm certainly not married to that format: http://imgur.com/a/wt7ga |
GuillaumeGomez
commented
Jun 29, 2017
bors
commented
Jun 29, 2017
📌 Commit 4154f89 has been approved by |
bors
commented
Jun 29, 2017
⌛ Testing commit 4154f89 with merge 1cd9a7050028a955b47c27d4d2789ba9e0c9c9d1... |
… r=GuillaumeGomez add `allow_fail` test attribute This change allows the user to add an `#[allow_fail]` attribute to tests that will cause the test to compile & run, but if the test fails it will not cause the entire test run to fail. The test output will show the failure, but in yellow instead of red, and also indicate that it was an allowed failure. Here is an example of the output: http://imgur.com/a/wt7ga
arielb1
commented
Jun 29, 2017
@bors retry - prioritizing rollup |
jonhoo
commented
Dec 3, 2017
Does this have a issue tracking stabilization? /cc @GuillaumeGomez@arielb1 |
GuillaumeGomez
commented
Dec 4, 2017
No. It should though. I'll open one. |
This change allows the user to add an
#[allow_fail]attribute totests that will cause the test to compile & run, but if the test fails
it will not cause the entire test run to fail. The test output will
show the failure, but in yellow instead of red, and also indicate that
it was an allowed failure.
Here is an example of the output: http://imgur.com/a/wt7ga