[issue9587] unittest.assertRaises() return the raised exception

Denver Coneybeare report at bugs.python.org
Sun Aug 15 20:53:40 CEST 2010


Denver Coneybeare <denver.coneybeare at gmail.com> added the comment:

Michael: Do you disagree with assertRaises() returning the exception object on principle?  Or is this just the consensus that you got from the mailing list, including Guido's comment.  My particular use case is that I want to check certain attributes being set on the raised exception and I feel that the context manager approach is overkill for my tests since it's just one method call in the context manager.  I don't understand why it is considered "odd" for assertRaises() to return the result for further inspection... I need to get it some way and assertRaises() has a reference to it.  Thanks for considering this request further.

----------

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


More information about the Python-bugs-list mailing list