[Python-Dev] setUpClass and setUpModule in unittest

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Thu Feb 11 16:25:40 CET 2010


On 10 Feb, 02:47 pm, olemis at gmail.com wrote:
>On Tue, Feb 9, 2010 at 6:15 PM,  <exarkun at twistedmatrix.com> wrote:
>>
>>For what it's worth, we just finished *removing* support for 
>>setUpClass and
>>tearDownClass from Trial.
>
>Ok ... but why ? Are they considered dangerous for modern societies ?

Several reasons:

  - Over the many years the feature was available, we never found anyone 
actually benefiting significantly from it.  It was mostly used where 
setUp/tearDown would have worked just as well.

  - There are many confusing corner cases related to ordering and error 
handling (particularly in the face of inheritance).  Different users 
invariably have different expectations about how these things work, and 
there's no way to satisfy them all.  One might say that this could apply 
to any feature, but...

  - People are exploring other solutions (such as testresources) which 
may provide better functionality more simply and don't need support deep 
in the loader/runner/reporter implementations.

Jean-Paul


More information about the Python-Dev mailing list