[py-dev] Ordering of setup and funcargs

Floris Bruynooghe flub at devork.be
Sun Sep 23 22:23:11 CEST 2012


Hello,

As I understand it the order of setup functions being called is:

pytest_runtest_setup
funcarg resources
@setup marked functions

And if you mark pytest_runtest_setup with trylast it will be moved
down to the bottom.  But it is impossible to get a @setup marked
function to be called before the funcarg resources are called.  This
means that in order to be able to influence what is possible inside
funcargs [0] you still need to use pytest_runtest_setup.  I have no
particular opinion on this (yet) but was surprised about this so
thought I'd point it out since it still forces plugin writers to use
pytest_runtest_setup in some cases.


[0] In my case monkeypatch django so you can't get access to it's
database using all of django's global state.

Regards,
Floris



More information about the Pytest-dev mailing list