[TIP] Fwd: cleanUp for unittest

Olemis Lang olemis at gmail.com
Fri Apr 3 12:52:25 PDT 2009


On Fri, Apr 3, 2009 at 2:14 PM, Fred Drake <fdrake at gmail.com> wrote:
> The zope.testing package provides a setupstack module that provides
> support for this (though with the clunky constraint that the cleanup
> function that calls the stacked cleanups has to be arranged for).
>
> Having a way to support this functional behavior as part of the
> standard TestCase class would be a substantial improvement over the
> current situation.  There should be a method to add a cleanup function
> and another to call them at the end as part of the base
> implementation.
>

Dont understand ? Why not to do it completely in a TestCase subclass
for the basic testing stack and another for your specific features ?

I dont see why this *CANT* be done outside TestCase ... and neither
why it *SHOULD* be done there ...

My opinion is the following : A simpler and more (general | abstract)
use case «add warnings to test cases» ... has been implemented using
TestDecorators (i.e. outside TestCase ...) so why should we put all
these complicated features and unnatural semantics in TestCase class ?

> If someone wants to handle the implementation of those differently,
> they can use subclass TestCase and use that instead where it matters.
>

To be precise you mean this (indentation means subclass ...):

[TestCase (like we know it today ...) + resource allocation]
   MyOwnResourceAlloc

I mean

TestCase (like we know it today ...)
     ResourceAllocTestCase
            MyOwnResourceAlloc

IMO resource allocation should be handled in a separate class (e.g.
using a mediator or something ...) or in a subclass ...

If there are already external mechanisms that handle all this ... I
don't get the idea ... :-/

--
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:



-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
Comandos : Pipe Viewer ... ¿Qué está pasando por esta tubería?



More information about the testing-in-python mailing list