On Sun, Aug 3, 2008 at 1:56 PM, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > On Tue, 29 Jul 2008 20:12:14 +0200, Nikolaus Rath <[EMAIL PROTECTED]> wrote: >> Jean-Paul Calderone <[EMAIL PROTECTED]> writes: >>> On Tue, 29 Jul 2008 19:26:09 +0200, Nikolaus Rath <[EMAIL PROTECTED]> wrote: >>>>Jean-Paul Calderone <[EMAIL PROTECTED]> writes: >>>>> On Tue, 29 Jul 2008 16:35:55 +0200, Nikolaus Rath <[EMAIL PROTECTED]> >>>>> wrote: >>>>>>Hello, >>>>>> >>>>>>I have a number of conceptually separate tests that nevertheless need >>>>>>a common, complicated and expensive setup. >>>>>> >>>>>>Unfortunately, unittest runs the setUp method once for each defined >>>>>>test, even if they're part of the same class as in > > ... > >> Yeah, well, I guess that would work. But to me this looks really more >> like a nasty hack.. isn't there a proper solution? > > [Someone described elsewhere in the thread how it's xUnit's philosophy > to have one environment per executed test.] > > One option is to look into other unit test tools. People sometimes > mention "py.test" as being superior. I haven't tried it -- I'm just a > slightly dissatisfied unittest user. > > http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#Python > > /Jorgen > > -- > // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu > \X/ snipabacken.se> R'lyeh wgah'nagl fhtagn! > -- > http://mail.python.org/mailman/listinfo/python-list >
py.test supports setup/teardown_module, setup/teardown_class and setup_teardown_method. I've never needed to use the first, the second comes in very handy especially when writing acceptance tests. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list