[pytest-dev] pytest-xdist-1.11: restarting crash nodes, fixture cache fix
Andreas Pelme
andreas at pelme.se
Fri Sep 19 09:06:48 CEST 2014
Hi,
First: Thanks for the fixes and release, my test suite runs fine with the new version!
On 18 sep 2014, at 20:56, holger krekel <holger at merlinux.eu> wrote:
> On Thu, Sep 18, 2014 at 20:51 +0200, Anatoly Bubenkov wrote:
>> hmm, but that grouping is not important for session scoped fixtures, right?
>> i mean, what's the sense of tearing down the session-scoped fixture, even
>> if most likely it will be not used by any test, earlier than the end of the
>> session?
>
> Parametrized session-scoped fixtures, for example, may depend on being torn
> down, not all be active at the same time. In any case, it's part of a
> general scheme to teardown fixtures as early as possible, not as late as
> possible. We can discuss/play with that and introduce an option which
> prohibits it, possibly.
I’d like an option/hint (in a sense similar to pytest.mark.trylast) to tell pytest to tear down fixtures as late as possible. Or a higher level scope than session, that is cached until the end of the entire test run.
I’ve was not aware of this situation until I hit issue 503, and have always assumed that session fixtures cannot be teared down more than once.
pytest-django’s internal fixtures and other fixtures I’ve written depends on having a single invocation for session fixtures. The teardown bugs in these fixtures can (and should) of course be fixed to work properly multiple times.
Even if these fixtures were correct, from a performance point of view, tearing down some of these fixtures is a big issue, since session fixtures are typically very slow in the first place.
Cheers,
Andreas
More information about the Pytest-dev
mailing list