-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
topic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstopic: tracebacksrelated to displaying and handling of tracebacksrelated to displaying and handling of tracebackstype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branchtype: feature-branchnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
Description
I noticed a potentially dangerous behaviour of parametrized tests. I have a parametrized test where arguments have to be filled in some "complicated" fashion, let's say via a call to _get_arguments():
import pytest
from mymodule import do_stuff
@pytest.mark.parametrize("argument", _get_arguments())
def test_arg_returns_nonempty(argument):
assert do_stuff(argument)
It may happen that _get_arguments() returns an empty list. In this case, the test is skipped. However, it may be better sometimes to mark the test as failed or errored in this case. Google suggests this is not currently possible via pytest, is this correct? Clearly, checks can be put elsewhere, but I think it would be useful, and less error prone, to be able to say something like noskip via another mark, or via an option of parametrize.
Thanks for the good work!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstopic: tracebacksrelated to displaying and handling of tracebacksrelated to displaying and handling of tracebackstype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branchtype: feature-branchnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch