Skip to content
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

Rename pending! method #10095

Open
straight-shoota opened this issue Dec 18, 2020 · 9 comments · May be fixed by #10160
Open

Rename pending! method #10095

straight-shoota opened this issue Dec 18, 2020 · 9 comments · May be fixed by #10160

Comments

@straight-shoota
Copy link
Member

The pending! method was introduced as a side effect in #9566 as a means to skip a spec at runtime when it can't be executed because the environment misses something (like multicast support).

I suggest to rename this method. "pending" means, something is awaiting conclusion.

This is the case for the specs that are not yet implemented. But a spec that can't execute because of a lacking environment at runtime is already completed. It won't be concluded (unless external factors are changed, but that's a different story) and thus pending! is not an adequate description.

A better name would be the generic skip!. It doesn't imply any reason for why it's skipped. It could be because the implementation of a particular branch is in fact "pending", but that's rarely the case. Mostly a spec would be skipped because of external factors.

Related: #10094

@jhass
Copy link
Member

jhass commented Dec 18, 2020

So you propose an entire new stat for this? Success, failed, errored, pending, skipped?

@straight-shoota
Copy link
Member Author

straight-shoota commented Dec 18, 2020

I doubt it's much use to report skipped and pending specs separately in the spec output. They should probably just be listed combined as skipped, whether it's because the spec is not implemented (pending) or for a different reason (skip!).

@Sija
Copy link
Contributor

Sija commented Dec 18, 2020

@straight-shoota Due to the different semantics there is a room for usefulness in reporting them separately.

@straight-shoota
Copy link
Member Author

Sure, there's room for later improvement ;) But right now, I'd like to simply change to skip and nothing more. pending! hasn't been in a release yet, so we can easily change it without reprecation.
Currently there isn't much use of it anyway, so let's have it in a release first and at a later point we can see if the reporting needs more granular refinement or not. There's nothing wrong with summarizing pending and skip! in the spec output.

@jhass
Copy link
Member

jhass commented Dec 18, 2020

I don't see much point in renaming it. Any spec that's not run is "awaiting conclusion" in some way, otherwise it would not have been written in the first place. In the multicast example that conclusion just lies within the external environment rather than the spec itself.

But then I also cannot really care less about how the functionality is called. I just didn't want to introduce yet another concept.

@straight-shoota
Copy link
Member Author

But these really are different concepts. Whether a spec is not implemented or can't run may ask for different handling. See #10094 for how this matters.

@straight-shoota straight-shoota linked a pull request Dec 30, 2020 that will close this issue
@bcardiff
Copy link
Member

I agree with @jhass. This would create a new concept and I see no need for that.

My choice to reduce the chance of a silent failure in the CI would be to add a "max pending allowed" or "error on pending". If that is not enough, allow "error on pending!" only could do the trick: like SPEC_ERROR_ON_PENDING=YES|BANG|NO.

Having something that an skipped spec, that is not pending is confusing to me.

@Fryguy
Copy link
Contributor

Fryguy commented Jan 19, 2021

In RSpec, one of the differences with pending is that you can actually implement the test and let it execute, but its failure condition is reversed. This allows you to know that once the pending condition is no longer valid, you can un-mark it as pending.

https://rspec.info/documentation/3.9/rspec-core/RSpec/Core/Pending.html

#pending
Marks an example as pending. The rest of the example will still be executed, and if it passes the example will fail to indicate that the pending can be removed.

#skip
Marks an example as pending and skips execution.

@straight-shoota
Copy link
Member Author

straight-shoota commented Jan 19, 2021

@bcardiff "error on pending!" does not make any sense whatsoever with the pre-existing pending method. This is a static designation for specs that are not expected to worth or not even implemented. Having such a pending example in the code base should never be a reason to fail the spec suite.

But pending! is different: It is used to skip specs that are normally expected to work but can't execute because of runtime contraints. Whether skipping an example should fail the spec suite depends on the environment. In an environment that doesn't support multicast, it's okay to skip, in an environment that is expected to support multicast it is not okay.

That is already a different concept. I'm not suggesting to introduce it, it's already here since #9566. This proposal is just about calling it out by not using the same names pending and pending! which confuses those different concepts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants