[TIP] cleanUp for unittest
doug.hellmann at gmail.com
Sat Apr 4 10:00:11 PDT 2009
On Apr 3, 2009, at 1:32 PM, Michael Foord wrote:
> holger krekel wrote:
>> On Fri, Apr 03, 2009 at 18:16 +0100, Michael Foord wrote:
>> hum, doesn't something like
>> def setUp(self):
>> express well enough what the poster wants to do?
>> Or am i missing something?
> It does but is an unacceptable solution because it changes the
> of the current behavior.
Funny, I thought that was a bug and wrote a subclass that "fixed" the
behavior for all of our tests. We use a lot of external fixtures in
our automated tests, so the rule is that all tear-down code needs to
be robust in case the thing being cleaned up does not exist, etc.
I also use the pattern of keeping a list of functions for the cleanup,
so +1 on adding that.
More information about the testing-in-python