[issue5679] cleanUp stack for unittest

Robert Collins report at bugs.python.org
Mon Apr 6 01:55:00 CEST 2009


Robert Collins <robertc at robertcollins.net> added the comment:

On Sun, 2009-04-05 at 23:49 +0000, Michael Foord wrote:
> 
> 
> As an interesting data point, the Bzr code does clean ups *before*
> tearDown.

No it doesn't:

We subclass unittest.TestCase. We also override run() to make tearDown
run always.

Our base test case class has it's tearDown:

    def tearDown(self):
        self._bzr_test_tearDown_run = True
        self._runCleanups()
        self._log_contents = ''
        unittest.TestCase.tearDown(self)

(which is to say, _runCleanups runs after any child classes tearDown,
even though we implement it by calling it from our base-most tearDown).

-Rob

----------

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


More information about the Python-bugs-list mailing list