[Python-ideas] unittest.failureExeption(msg, data=None): add optional data kwarg to failureException() of unittest

Neil Girdhar mistersheik at gmail.com
Wed Mar 4 02:45:38 CET 2015


Says it right in the documentation:

failureException 
<https://docs.python.org/2/library/unittest.html#unittest.TestCase.failureException>

This class attribute gives the exception raised by the test method. If a 
test framework needs to use a specialized exception, possibly to carry 
additional information, it must subclass this exception in order to “play 
fair” with the framework. The initial value of this attribute is 
AssertionError 
<https://docs.python.org/2/library/exceptions.html#exceptions.AssertionError>
.

On Tuesday, March 3, 2015 at 3:34:02 AM UTC-5, Thomas Güttler wrote:
>
> Hi,
>
> what do you think about the idea to add an optional data kwarg to 
> unittest.failureExeption()?
>
> Up to now a the exception class "failureException" does only get a message 
> which is a string.
>
> I would like to log the failed Exceptions to a structured logging back end.
>
> Parsing the string message to extract the real value is possible, but 
> somehow ugly and error prone.
>
> My high level use case: Have a system (maybe ELK-Stack) to investigate if 
> a test failure was seen before.
>
> Doing this on strings could work, but I would like to keep the original 
> (json serializable) values.
>
> What do you think?
>
>    Thomas Güttler
> _______________________________________________
> Python-ideas mailing list
> Python... at python.org <javascript:>
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150303/c07e90b3/attachment-0001.html>


More information about the Python-ideas mailing list