pytest.mark.parametrize
decoratorsMultiple pytest.mark.parametrize
decorators could be used in test functions to get the cartesian product of the parameters.
This snippet:
import itertools
import pytest
numbers = [1,2,3,4,5]
vowels = ['a','e','i','o','u']
@pytest.mark.parametrize(
itertools.product(number, vowels)
)
def test(number, vowel):
...
is equivalent to this other snippet.
import pytest
numbers = [1,2,3,4,5]
vowels = ['a','e','i','o','u']
@pytest.mark.parametrize('number', numbers)
@pytest.mark.parametrize('vowel', vowels)
def test(number, vowel):
pass