[New-bugs-announce] [issue5663] Better failure messages for unittest assertions

Michael Foord report at bugs.python.org
Thu Apr 2 03:58:40 CEST 2009


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

Patch for unittest on trunk.

It provides better default failure messages for assertTrue and
assertFalse (current is "AssertionError: None").

It also provides a new class attribute for TestCase: longMessage

This defaults to False. If set to True, passing in an explicit custom
message does *not* override the helpful default failure message in
asserts which tell you which objects were involved in the failure.

Even if set to True or False in a TestCase then longMessage can still be
overridden in individual tests by setting an instance attribute.



Needs docs.

Could longMessage default to True in 3.1.

----------
components: Library (Lib)
files: unittest-messages.diff
keywords: patch
messages: 85136
nosy: mfoord
severity: normal
status: open
title: Better failure messages for unittest assertions
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file13567/unittest-messages.diff

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


More information about the New-bugs-announce mailing list