-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarificationtype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature
Description
I sometimes write tests something like this:
@pytest.mark.parametrize('foo, bar', itertools.product(['a', 'b', 'c'], [1, 2, 3]))
def test_things(foo, bar):
...
to test all combinations of foo
and bar
. The itertools.product
call sometimes gets a bit more complicated which makes this hard to follow.
IMHO, it'd be nicer to be able to write those tests like this:
@pytest.mark.parametrize('foo', ['a', 'b'. 'c'])
@pytest.mark.parametrize('bar', [1, 2, 3])
def test_things(foo, bar):
...
And pytest would then generate all possible combinations. What are your thoughts on this?
I'm not sure if the difference between using two args in one parametrize
call vs. using two parametrize
calls with one argument each is too subtle, though.
jxramos, djmattyg007, clefourrier, MJafarMashhadi, Yay295 and 3 more
Metadata
Metadata
Assignees
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarificationtype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature