[py-dev] using funcargs for setup/teardown

Frederik Dohr fdg001 at gmx.net
Sun Oct 25 15:01:45 CET 2009

> It contains many examples and also a reference for the API. 
> I consider splitting the two aspects.

That's probably a good idea.

> If py.test did some basic logging that shows which user code is
> invoked when (e.g. test function, setup functions, funcarg
> factories, plugin or conftest hooks ...) it would make such
> help-examples smaller and more focused.
> [...]
> Below is a try at explaining funcargs from a "read-source" perspective. 

Unfortunately, I cannot relate to this - likely due to my overall
ignorance when it comes to funcargs.

However, I've finally figured out why I'm having such a hard time
warming up to funcargs: They go way beyond the minimalist simplicity
that made me switch to py.test in the first place.
(I realize there's some Magic to py.test's internals, but that doesn't
surface in the API.)

Funcargs seem like a departure from this principle.
I understand that some situations demand such complexity, so I'm not
arguing against funcargs in general - but for my part, I've managed to
keep it simple so far.

All of this is to say that I'm happy enough with this for setup and
teardown*, but I'm probably the wrong person to comment on anything
beyond that.

-- F.

* although I'm considering writing two decorators to easily turn any
   function into a setup or teardown method

More information about the Pytest-dev mailing list