[Twisted-Python] Trial Test Runner

Jean-Paul Calderone exarkun at divmod.com
Fri Nov 17 07:00:37 MST 2006


On Fri, 17 Nov 2006 14:22:14 +0100, Markus Schiltknecht <markus at bluegap.ch> wrote:
>Hi,
>
>Ralph Meijer wrote:
>>You can use class inheritance. Define A deriving from object, and then B
>>from A and TestCase, for example.
>
>That only works for Fixtures which take a few milliseconds to setUp and 
>tearDown, because for every derived TestCase, the Fixture is setUp and 
>tornDown. That won't work in my case, because setting up the Fixture is 
>quite complex and takes up to 20 seconds. I definitely don't want to do that 
>for every contained TestCase.
>
>Why does the TrialSuite not have setUp and tearDown methods?

It is not intended that users will subclass TrialSuite.

You can put your expensive set up code into a free function which caches
its result to avoid performing redundant work, then call it from whichever
setUp methods need it.

Jean-Paul




More information about the Twisted-Python mailing list