fix issue 176: raises(AssertionError) now catches builtin AssertionError as well
This commit is contained in:
@@ -777,6 +777,11 @@ def raises(ExpectedException, *args, **kwargs):
|
||||
<ExceptionInfo ...>
|
||||
"""
|
||||
__tracebackhide__ = True
|
||||
if ExpectedException is AssertionError:
|
||||
# we want to catch a AssertionError
|
||||
# replace our subclass with the builtin one
|
||||
# see https://bitbucket.org/hpk42/pytest/issue/176/pytestraises
|
||||
from exceptions import AssertionError as ExpectedException
|
||||
|
||||
if not args:
|
||||
return RaisesContext(ExpectedException)
|
||||
|
||||
Reference in New Issue
Block a user