[pytest-dev] Parametrized scope question

Alex Netes alexn at final.co.il
Mon Dec 14 10:50:57 EST 2015


Hello guys,

I'm new to Pytest and I encounter something I cannot explain.
I'm trying to give fixture fixt_func() a parameter fixt_prm and expect the fixture to be called only once as it defined with 'class' scope, but the fixture is called twice as it ignores the scope. What am I missing?


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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20151214/44e4b967/attachment.html>


More information about the pytest-dev mailing list