[py-dev] reversing fixture/xunit setup call order?

holger krekel holger at merlinux.eu
Sun Dec 16 20:24:18 CET 2012

On Sun, Dec 16, 2012 at 13:21 +0100, Ronny Pfannschmidt wrote:
> sounds like the correct curse of action else legacy tests cant be
> integrated with fixtures propperly

"curse of action" ... like that one :)

> i wonder if we should go as far as allowing fixtures to be arguments
> to pytest xunit test functions

that'd be tricky at least for setup_module and setup_method/function which
support a positional argument.  Note that you can easily turn your setup
function into one that accepts fixtures:

    def setup_method(self, request, tmpdir, ...):

In this case there is no positional argument but you can get the
current function under test via ``request.function``.
I think it's clearer to add that extra line.


> On 12/16/2012 12:23 PM, holger krekel wrote:
> >Hi all,
> >
> >Currently, if you define e.g. an autouse fixture function it is going to
> >be called _after_ the xUnit setup functions.  This is especially
> >surprising when you do a session-scoped autouse fixture.  I am wondering
> >if we could reverse the order, i.e. call fixture functions (including
> >autouse-fixtures of course) ahead of xUnit setup methods.
> >
> >any thoughts?
> >
> >holger
> >_______________________________________________
> >py-dev mailing list
> >py-dev at codespeak.net
> >http://codespeak.net/mailman/listinfo/py-dev

More information about the Pytest-dev mailing list