[unittest] Run setUp only once
grahn+nntp at snipabacken.se
Sun Aug 3 22:56:10 CEST 2008
On Tue, 29 Jul 2008 20:12:14 +0200, Nikolaus Rath <Nikolaus at rath.org> wrote:
> Jean-Paul Calderone <exarkun at divmod.com> writes:
>> On Tue, 29 Jul 2008 19:26:09 +0200, Nikolaus Rath <nikolaus at rath.org> wrote:
>>>Jean-Paul Calderone <exarkun at divmod.com> writes:
>>>> On Tue, 29 Jul 2008 16:35:55 +0200, Nikolaus Rath <nikolaus at rath.org> wrote:
>>>>>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.
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se> R'lyeh wgah'nagl fhtagn!
More information about the Python-list