Hi Wolfgang,

On Mon, Apr 07, 2014 at 13:18 +0200, Wolfgang Schnerring wrote:
> Hello Holger,
> 
> * holger krekel <[email protected]> [2014-04-07 10:24]:
> > On Fri, Apr 04, 2014 at 11:21 +0200, Wolfgang Schnerring wrote:
> > > is there a way to access a fixture object from inside a unitest.TestCase
> > >   test function?
> > Right, any "usefixture" needs to either have a global side effect
> > or stick some object to "self".
> >         @pytest.fixture(autouse=True)
> >         def set_tmpdir(self, tmpdir):
> >             self.tmpdir = tmpdir
> 
> Thanks for the hint! Using a method of the TestCase as a wrapper
> fixture around the actual fixture is clever, but also a little
> unwieldy... would there be an easy way to introduce an API to make 
> that easier?

Thing is that trying to bring pytest fixtures to unittest.TestCase's
methods directly is very hard, especially given the many
extensions/subclasses that people use.  If unittest had a plugin
system that would help.

do you have to inherit unittest.TestCase, btw? 
If you don't, all problems go away :)

best,
holger



> Wolfgang
> 
> _______________________________________________
> Pytest-dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/pytest-dev
> 
_______________________________________________
Pytest-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to