-
Notifications
You must be signed in to change notification settings - Fork 89
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
Feature request: skip_remaining
#919
Comments
Assuming you use if (SHOULD_SKIP) {
done_testing;
exit(0)
} A real implementation would need more logic to account for subtests and fixed plans, here is one with some pseudo-code. Everything here is possible, I just do not remember the implementation details off the top of my head, but if anyone wants tthis and wants to give it a go implementing this, I would gladly merge a PR that introduces this to Test2::Tools::Basic; sub skip_remaining {
my $ctx = context();
if (PSEUDO_CODE_NO_PLAN_SET) {
$ctx->hub->finalize($ctx->trace, 1);
}
else {
$ctx->PSEUDO_SEND_SKIPPED_OK for $PSEUDO_PLAN - $PSEUDO_CURRENT_COUNT;
}
$ctx->release;
exit(0) if PSEUDOCODE_NOT_IN_SUBTEST; # Exit if we are not in a subtest
last T2_SUBTEST_WRAPPER; # Terminate the subtest
die "Scope Leak"; # Should never get here
} |
Well, openQA's Basically it seems like on recent versions of everything, you can only safely use I will have a go at doing the implementation you suggested if I find time (thanks for the starting point!), can't promise I will though, unfortunately :( |
Then add some logic to skip_remaining to simply call skip_all if no tests have been run. |
it occurred to me to put some logic like that into openQA's |
|
oh, and |
Test::Needs may work for your use case. It tries to handle skipping tests with skip_all if possible, or skipping the remaining tests if there was already a test plan issued. |
FWIW, this discussion inspired me to poke around in the code a bit more and I wound up finding a decent workaround for this specific downstream case which makes this need less important for now. I'll leave it up to you folks to decide if you want to still keep it open or not. |
In os-autoinst/openQA#5349 we're dealing with a situation where a set of tests calls a setup function that, for convenience, uses two
get_ok
calls, which are considered to be tests. After the setup, we may want to skip the actual tests from27-plugin_obs_rsync_status_details.t
- but we can't useskip_all
to do this, because we've already run two "tests", and Test::More doesn't seem to like it if you try toskip_all
after any "tests" have already run.It would be convenient in this case if there was a
skip_remaining
, or just ifskip_all
could behave asskip_remaining
when called after some tests have already run...The text was updated successfully, but these errors were encountered: