summaryrefslogtreecommitdiff
path: root/passlib
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2011-06-04 01:42:00 -0400
committerEli Collins <elic@assurancetechnologies.com>2011-06-04 01:42:00 -0400
commit435a8464f8363f7d8d20d0e1f5abe852edc0a40e (patch)
tree19e96dc82538d76300f88c43d570215478f3b44d /passlib
parent4fb51fcd7a36a465664bfa029dd5ce0fe76eb5c7 (diff)
downloadpasslib-435a8464f8363f7d8d20d0e1f5abe852edc0a40e.tar.gz
cleaned up try/except clause that caused issue under py3
Diffstat (limited to 'passlib')
-rw-r--r--passlib/tests/utils.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/passlib/tests/utils.py b/passlib/tests/utils.py
index f77314f..e5e147a 100644
--- a/passlib/tests/utils.py
+++ b/passlib/tests/utils.py
@@ -162,17 +162,15 @@ class TestCase(unittest.TestCase):
def assertRaises(self, type, func, *args, **kwds):
msg = kwds.pop("__msg__", None)
- err = None
try:
result = func(*args, **kwds)
except Exception, err:
- pass
- if err is None:
- msg = self._format_msg(msg, "function returned %r, expected it to raise %r", result, type)
- raise AssertionError(msg)
- elif not isinstance(err, type):
+ if isinstance(err, type):
+ return True
msg = self._format_msg(msg, "function raised %r, expected %r", err, type)
raise AssertionError(msg)
+ msg = self._format_msg(msg, "function returned %r, expected it to raise %r", result, type)
+ raise AssertionError(msg)
def assertFunctionResults(self, func, cases):
"""helper for running through function calls.