Re: [pytest-dev] Parametrized scope question

2015-12-15 Thread holger krekel
On Tue, Dec 15, 2015 at 14:11 +, Alex Netes wrote: > > I think you could use a marker on the class or even just a class attribute: > > > > import pytest > > > > @pytest.fixture(scope="class") > > def fix(request): > > return request.cls.attr * 10 > > > > class TestA:

Re: [pytest-dev] Parametrized scope question

2015-12-15 Thread Alex Netes
Hi holger, Thanks for your help. > Hi Alex, > > On Mon, Dec 14, 2015 at 15:50 +, Alex Netes wrote: >> Hello guys, >> >> I'm new to Pytest and I encounter something I cannot explain. > > I also hit many things which i can not explain, even with pytest and maybe > even with this very mail.

Re: [pytest-dev] Parametrized scope question

2015-12-15 Thread Alex Netes
Hi holger, > Hi Alex, > > On Tue, Dec 15, 2015 at 09:18 +, Alex Netes wrote: > > Hi holger, > > > > Thanks for your help. > > > > > Hi Alex, > > > > > > On Mon, Dec 14, 2015 at 15:50 +, Alex Netes wrote: > > >> Hello guys, > > >> > > >> I'm new to Pytest and I encounter something I

Re: [pytest-dev] Parametrized scope question

2015-12-15 Thread Bruno Oliveira
Hi, Another option is to use fixtures to obtain the values, since fixtures can be overwritten in subclasses: import pytest class Base: @pytest.fixture(scope='class') def param(self): assert 0 @pytest.yield_fixture(scope='class') def fix(self, param, request):

Re: [pytest-dev] Parametrized scope question

2015-12-14 Thread holger krekel
Hi Alex, On Mon, Dec 14, 2015 at 15:50 +, Alex Netes wrote: > Hello guys, > > I'm new to Pytest and I encounter something I cannot explain. I also hit many things which i can not explain, even with pytest and maybe even with this very mail. > I'm trying to give fixture fixt_func() a

[pytest-dev] Parametrized scope question

2015-12-14 Thread Alex Netes
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?