[pytest-dev] Access fixtures from unittest.TestCase
Wolfgang Schnerring
ws at gocept.com
Mon Apr 7 13:18:31 CEST 2014
Hello Holger,
* holger krekel <holger at merlinux.eu> [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?
Wolfgang
More information about the Pytest-dev
mailing list