[New-bugs-announce] [issue5679] cleanUp stack for unittest

Michael Foord report at bugs.python.org
Fri Apr 3 21:56:47 CEST 2009


New submission from Michael Foord <michael at voidspace.org.uk>:

Proposal to add a cleanUp stack to unittest.TestCase. This is a list of
callables to be called (LIFO) to cleanup resources. If there are items
on the stack it should be called even if setUp fails. Otherwise it
should be called after tearDown.

Similar functionality is in the testing frameworks used by bzr, Twisted,
and Zope.

I will create a patch similar to the bzr implementation.

The public API is via a new method:

    def addCleanUpItem(self, callable, *args, **kwargs):

Usage is:

    self.db = self.createDB()
    self.addCleanUpItem(self.db.close)

----------
assignee: michael.foord
components: Library (Lib)
messages: 85321
nosy: michael.foord
severity: normal
status: open
title: cleanUp stack for unittest
type: behavior
versions: Python 2.7

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


More information about the New-bugs-announce mailing list