[Python-ideas] Test Class setup and teardown in unittest

Jonathan Lange jml at mumak.net
Fri Jan 22 01:31:32 CET 2010


Mark Roddy <markroddy at ...
> writes:
> On Wed, Jan 20, 2010 at 8:37 PM, Robert Collins
> <robertc at ...> wrote:
...
> > I'd much much much rather see e.g. testresources integrated into the
> > core allowing fixtures to be shared across test instances in a way that
> > doesn't prohibit their use with concurrent testing, doesn't make it
> > awkward to do it across multiple classes. I'm happy to make any
> > [reasonable] changes (including license) to testresources to make it
> > includable in the stdlib if that's of interest.
>
> A pretty good approach for a complicated setup, but in a simple case
> where you only need a line or two it seems like a lot of boiler plate
> to get the job done.  Though I'll look into this library a little more
> as I am not intimately familiar with it at the moment.

Yeah, it is a lot of boiler plate when you need only a couple of lines of code. 
There should be some convenience APIs on top of testresources. That way, you'll 
get the "nice and easy" along with support for test isolation, randomization and 
a declarative interface for those who prefer it.

jml




More information about the Python-ideas mailing list