summaryrefslogtreecommitdiff
path: root/test/testlib/testing.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/testlib/testing.py')
-rw-r--r--test/testlib/testing.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/testlib/testing.py b/test/testlib/testing.py
index 3406e3504..1e24108dd 100644
--- a/test/testlib/testing.py
+++ b/test/testlib/testing.py
@@ -459,13 +459,12 @@ class TestBase(unittest.TestCase):
"""overridden to not return docstrings"""
return None
- def assert_raises(self, callable_, except_cls, reg):
+ def assertRaisesMessage(self, except_cls, msg, callable_, ):
try:
callable_()
assert False, "Callable did not raise expected exception"
- except Exception, e:
- assert isinstance(e, except_cls), "Exception was not an instance of '%s' ('%s')" % (except_cls, type(e))
- assert re.search(reg, str(e)), "Callable raised non-matching exception: '%s'" % str(e)
+ except except_cls, e:
+ assert re.search(msg, str(e)), "Exception message did not match: '%s'" % str(e)
if not hasattr(unittest.TestCase, 'assertTrue'):
assertTrue = unittest.TestCase.failUnless