Skip to content

Pytest class scope fixture for a parametrized test called once for each parameter #1192

Closed
@alnet82

Description

@alnet82

fixt_finc fixture defined with class scope is being called twice - for every value of prm.
I expected it to be called only once. What am I missing here?

@pytest.fixture(scope='class')
def fixt_func(request, resource):
    print "fixt_func"

class TestA():
    @pytest.mark.parametrize('resource', ['x'], scope='class')
    @pytest.mark.parametrize('prm', ['a', 'b'])
    def test_a(self, prm, fixt_func)
        assert True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions