[TIP] pytest: Setup/TearDown with fixtures

Floris Bruynooghe flub at devork.be
Thu Sep 4 11:55:36 PDT 2014


On 4 September 2014 09:23, holger krekel <holger at merlinux.eu> wrote:
> On Wed, Sep 03, 2014 at 21:08 +0100, Floris Bruynooghe wrote:
>>     @pytest.fixture(scope='class', autouse=True)
>>     def session(self, request):
>>         session = foo.session()
>>         request.addfinalizer(session.logout)
>
> I guess you want to "return session" here in order for test_bar to receive it.

Oops, yes of course!


-- 
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org



More information about the testing-in-python mailing list