diff options
Diffstat (limited to 'qa/rpc-tests/util.py')
-rw-r--r-- | qa/rpc-tests/util.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/qa/rpc-tests/util.py b/qa/rpc-tests/util.py index 6b66bfd8f6..ec65f783e8 100644 --- a/qa/rpc-tests/util.py +++ b/qa/rpc-tests/util.py @@ -330,4 +330,14 @@ def assert_equal(thing1, thing2): def assert_greater_than(thing1, thing2): if thing1 <= thing2: - raise AssertionError("%s <= %s"%(str(thing1),str(thing2)))
\ No newline at end of file + raise AssertionError("%s <= %s"%(str(thing1),str(thing2))) + +def assert_raises(exc, fun, *args, **kwds): + try: + fun(*args, **kwds) + except exc: + pass + except Exception as e: + raise AssertionError("Unexpected exception raised: "+type(e).__name__) + else: + raise AssertionError("No exception raised") |