diff options
| author | Scott Dugas <scott.dugas@foundationdb.com> | 2014-10-23 10:24:35 -0400 |
|---|---|---|
| committer | Scott Dugas <scott.dugas@foundationdb.com> | 2014-10-23 10:24:35 -0400 |
| commit | 9c0eb840788ed5971f0876958cfb9866c7af918d (patch) | |
| tree | e31ef8f37e0a4d77c06a49cdadff2e91b3587dce /lib/sqlalchemy/testing | |
| parent | 25434e9209af9ee2c05b651bc4fe197541c0bd60 (diff) | |
| download | sqlalchemy-9c0eb840788ed5971f0876958cfb9866c7af918d.tar.gz | |
Print useful traceback on error
_expect_failure was rethrowing the exception without keeping the
traceback, so it was really hard to find out what was actually wrong
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/exclusions.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/testing/exclusions.py b/lib/sqlalchemy/testing/exclusions.py index 283d89e36..5ce8bcd84 100644 --- a/lib/sqlalchemy/testing/exclusions.py +++ b/lib/sqlalchemy/testing/exclusions.py @@ -12,6 +12,7 @@ from ..util import decorator from . import config from .. import util import inspect +import sys import contextlib @@ -120,20 +121,21 @@ class compound(object): try: return_value = fn(*args, **kw) - except Exception as ex: - self._expect_failure(config, ex, name=fn.__name__) + except Exception: + exc_type, exc_value, exc_traceback = sys.exc_info() + self._expect_failure(config, exc_type, exc_value, exc_traceback, name=fn.__name__) else: self._expect_success(config, name=fn.__name__) return return_value - def _expect_failure(self, config, ex, name='block'): + def _expect_failure(self, config, exc_type, exc_value, exc_traceback, name='block'): for fail in self.fails: if fail(config): print(("%s failed as expected (%s): %s " % ( name, fail._as_string(config), str(ex)))) break else: - raise ex + raise exc_type, exc_value, exc_traceback def _expect_success(self, config, name='block'): if not self.fails: |
