-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytopic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Adding Fixtures to a parametrization of a test function via pytest.mark.usefixtures has no effect. The fixtures are not executed and are missing from request.fixturenames.
Example:
import pytest
@pytest.fixture
def c():
return []
@pytest.fixture
def a(c):
c.append('a')
@pytest.fixture
def b(c):
c.append('b')
@pytest.mark.parametrize('expected', [
pytest.param(['a'], marks=pytest.mark.usefixtures('a'), id='a'),
pytest.param(['b'], marks=pytest.mark.usefixtures('b'), id='b'),
])
def test_usefixtures_param(request, c, expected):
assert c == expected$ pip list
Package Version
-------------- -------
atomicwrites 1.2.1
attrs 18.2.0
more-itertools 4.3.0
pip 18.1
pluggy 0.7.1
py 1.6.0
pytest 3.8.2
setuptools 40.4.3
six 1.11.0
wheel 0.32.1
nchammas, DKorytkin, bloussou and DenisKuplyakov
Metadata
Metadata
Assignees
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytopic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressedproblem that needs to be addressed