Skip to content

Is it possible to parameterize using array of fixtures? #382

@MarcelWilson

Description

@MarcelWilson

I noticed that fixtures (while in an array) don't behave the same in parameterize. Is it possible to put fixtures into arrays for parameterize? If so, how?

@pytest.fixture(scope="class")
def fix_a() -> int:
    return 123

@pytest.fixture(scope="class")
def fix_b() -> int:
    return 456

@pytest.fixture(scope="class")
def fix_c() -> int:
    return 789

@pytest.fixture(scope="class")
def fix_d() -> int:
    return 345

class TestSample:
    @pytest_cases.parametrize("exp,tup", [
        ( 123, (fix_a, fix_c)),
        ( 456, (fix_b, fix_d)),
    ])
    def test_func(self, exp, tup):
        assert tup[0] == exp

AssertionError: assert <pytest_fixture(<function fix_b at 0x10738df30>)> == 456

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions