-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Combining multiple mark.parametrize
is easy. Just go
import pytest
@pytest.mark.parametrize('foo', ['a', 'b', 'c'])
@pytest.mark.parametrize('bar', [1, 2, 3])
def test_things(foo, bar):
assert foo in ['a', 'b', 'c']
assert bar in [1, 2, 3]
However, this fails if one of the two parametrizations covers more than one argument. This
import pytest
@pytest.mark.parametrize('foo', 'bar', [('a', 1), ('b', 2), ('c', 3)])
@pytest.mark.parametrize('baz', [4, 5, 6])
def test_things(foo, bar, baz):
assert foo in ['a', 'b', 'c']
assert bar in [1, 2, 3]
assert baz in [4, 5, 7]
fails with error
E ValueError: indirect given to <function test_things at 0x7f3c2881e2f0>: fixture ('a', 1) doesn't exist
This is with
$ pytest --version
This is pytest version 3.6.2, imported from /path/to/pytest.py
Metadata
Metadata
Assignees
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressedproblem that needs to be addressed