diff options
Diffstat (limited to 'lib/sqlalchemy/test/testing.py')
| -rw-r--r-- | lib/sqlalchemy/test/testing.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/test/testing.py b/lib/sqlalchemy/test/testing.py index 3689ca0b7..9c5c87f3f 100644 --- a/lib/sqlalchemy/test/testing.py +++ b/lib/sqlalchemy/test/testing.py @@ -497,9 +497,12 @@ def startswith_(a, fragment, msg=None): def assert_raises(except_cls, callable_, *args, **kw): try: callable_(*args, **kw) - assert False, "Callable did not raise an exception" + success = False except except_cls, e: - pass + success = True + + # assert outside the block so it works for AssertionError too ! + assert success, "Callable did not raise an exception" def assert_raises_message(except_cls, msg, callable_, *args, **kwargs): try: |
