Skip to content

Test parametrization does not affect the fixture dependency tree #2220

@sermoz

Description

@sermoz

pytest v3.0.5

@pytest.fixture
def fix1(fix2):
   return fix2 + '1'

@pytest.fixture
def fix2(fix3):
   return fix3 + '2'

@pytest.fixture
def fix3():
   print("fix3 instantiated!!")
   return '3'

@pytest.mark.parametrize('fix2', ['2'])
def test_it(fix1):
   assert fix1 == '21'

This example demonstrates that fix3 is still instantiated, although fix2 - fix3 dependency should have been broken because of parametrization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions