[issue5679] cleanUp stack for unittest

Michael Foord report at bugs.python.org
Sun Apr 5 23:35:00 CEST 2009


Michael Foord <michael at voidspace.org.uk> added the comment:

This is actually a minor point about the order things happen in. I don't
think it will cause confusion in practise once we have made a decision
and documented it.

Particularly if we decide to call clean ups before tearDown then I will
make adding new ones during tearDown raise an exception.

I did think about having two separate clean up stacks - one for those
added during setUp and one for those added during tests, but that is
starting to get silly. 

The point about this patch is that it makes the deallocation of
resources a lot simpler without having to manually track them inside
your test (nested try finallys for this are not uncommon in the tests
I've seen) and the fact that this mechanism is already in use in the
test frameworks of three major projects indicate that it is definitely
worthwhile.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5679>
_______________________________________


More information about the Python-bugs-list mailing list