[issue20362] longMessage attribute is ignored in unittest.TestCase.assertRegexpMatches etc

Dhara report at bugs.python.org
Thu Jan 23 10:39:37 CET 2014


New submission from Dhara:

Various assert methods added in version 2.7 ignore the longMessage attribute:
http://docs.python.org/2.7/library/unittest.html#unittest.TestCase.longMessage

For example when matching regular expressions using unittest.TestCase.assertRegexpMatches, the following error is generated:

AssertionError: <custom short message>: '<regexp>' not found in '<text>'

Since longMessage is ignored, and the text to be matched can be pages long, the error messages are impossibly long.

[See also: http://stackoverflow.com/questions/21157905/suppress-supplementary-error-message-from-unit-test]

----------
components: Library (Lib)
messages: 208899
nosy: Dhara
priority: normal
severity: normal
status: open
title: longMessage attribute is ignored in unittest.TestCase.assertRegexpMatches etc
type: behavior
versions: Python 2.7

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


More information about the Python-bugs-list mailing list