[py-dev] funcarg in a class

holger krekel holger at merlinux.eu
Fri Jan 1 19:46:25 CET 2010


On Fri, Jan 01, 2010 at 19:37 +0100, holger krekel wrote:
> On Thu, Dec 31, 2009 at 17:25 +0000, Joan Miller wrote:
> > Is possible to run a funcarg inner of a class? The nex code doesnt works.
> > 
> > --------------------------
> > class TestFoo(object):
> > 
> >     def pytest_funcarg__myfuncarg(self, request):
> >         return 13
> > 
> > 
> >     def test_function(self, append):
> >         assert self.myfuncarg == 13
> 
> you need to pass in "myfuncarg" instead of "append". 
> That should work fine. 

to be precise:

    def test_function(self, myfuncarg):
        assert myfuncarg == 13

should work.  or do you mean something else? 

cheers and happy new year! 
holger



More information about the Pytest-dev mailing list