[New-bugs-announce] [issue32487] assertRaises should return the "captured" exception

Facundo Batista report at bugs.python.org
Wed Jan 3 10:41:56 EST 2018


New submission from Facundo Batista <facundo at taniquetil.com.ar>:

Sometimes it's nice to do extra checks on the error raised and captured by self.assertRaises call.

Yes, the same can be achieved using assertRaises as a context manager and then accessing the `exception` attribute in the context manager, but it looks too cumbersome to just get the exception, when it can be simply returned by the assertRaises call.

Note 1: Currently it returns None, so no backward compatibility problem.

Note 2: assertRaises in testtools does this and is very useful

----------
messages: 309414
nosy: facundobatista
priority: normal
severity: normal
stage: needs patch
status: open
title: assertRaises should return the "captured" exception
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32487>
_______________________________________


More information about the New-bugs-announce mailing list