[issue5679] cleanUp stack for unittest

Antoine Pitrou report at bugs.python.org
Sun Apr 5 01:02:28 CEST 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

>    def setUp(self):
>         dirname = mkdtemp()
>         self.addCleanup(shutils.rmtree, dirname, ignore_errors=True)
>         db = make_db(dirname)
>         self.addCleanup(db.tearDown)

Sure, but that's an example of doing something which is already doable
without addCleanup (resource allocation in setUp).
I was talking about doing resource allocation in the test methods
themselves, which is /only/ possible using addCleanup, and needs
cleanups to be run before tearDown, not after.

----------

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


More information about the Python-bugs-list mailing list