[TIP] setup pytest fixtures in parallel

RonnyPfannschmidt opensource at ronnypfannschmidt.de
Thu Nov 23 23:29:50 PST 2017


Hi Wouter,


currently there is no way to do fixture setup in parallel and also no
underlying structure to implement concurrent and/or parallel fixture
creation.
enabling something like it is no easy feat and requires a major rework
of the internals of the pytest fixture system.


-- Ronny



Am 24.11.2017 um 08:02 schrieb Wouter Overmeire:
> Hi,
>
> Is there a way in pytest (or a plugin) to setup test fixtures in parallel?
> Not running the tests in // but only setup the fixtures in //.
>
> Suppose I have a number of tests and each have a different number of
> fixtures.
> The fixtures take long to setup, given they are independent of each
> other and not cpu limited, setup could be done in //.
>
> I prefer not to stuff all fixtures in one major fixture and control
> from this one how to build.
> Not all tests use the same fixtures, and fixtures come and go. Ideally
> I`m looking for a way to add additional decorator (or arg on existing
> fixture pytest decorator) on a fixture indicating it can be setup in //.
>
> I`m familiar with the concept of scope on fixtures, but even for
> session scoped fixtures I would like to setup them in //.
>
> Probably not so trivial given fixtures can be hierarchical.
>
> The hook pytest_fixture_setup looks the way to go, I`m wondering how
> to run rest of the fixture setup chain in a thread and return the
> fixture when done, This feels like breaking the api model behind
> hooks, given return value of hook determines to stop the chain. Not
> modify rest of the call chain.
>
> Wouter
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20171124/cac41ba7/attachment.htm>


More information about the testing-in-python mailing list