[New-bugs-announce] [issue5531] unittest: allow failures in tearDown method

Tim Cuthbertson report at bugs.python.org
Sat Mar 21 10:52:37 CET 2009


New submission from Tim Cuthbertson <tim3d.junk at gmail.com>:

This patch adds the behaviour that when a unittest.failureException is
thrown in a TestCase's tearDown method, the test case is added to the
failures list (instead of the errors list, and only when the test case
body has passed successfully).

In some circumstances, tests may want to assert that something happens
at some point during the body of a test, and the best time to make these
checks can be in the tearDown method.

This is a modification I've made during development of my mocktest
library (https://github.com/gfxmonk/mocktest/tree), and I believe it is
beneficial to have as the default unittest behaviour.

----------
components: Extension Modules
files: unittest-fail-on-teardown-0.patch
keywords: patch
messages: 83927
nosy: gfxmonk
severity: normal
status: open
title: unittest: allow failures in tearDown method
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13387/unittest-fail-on-teardown-0.patch

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


More information about the New-bugs-announce mailing list