tests: log original traceback in assertRaises().

pull/295/head
David Wilson 6 years ago
parent ff2f44b046
commit 46ec0ffcaf

@ -25,6 +25,7 @@ except ImportError:
from io import StringIO from io import StringIO
LOG = logging.getLogger(__name__)
DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
sys.path.append(DATA_DIR) sys.path.append(DATA_DIR)
@ -185,6 +186,7 @@ class TestCase(unittest2.TestCase):
e = sys.exc_info()[1] e = sys.exc_info()[1]
return e return e
except BaseException: except BaseException:
LOG.exception('Original exception')
e = sys.exc_info()[1] e = sys.exc_info()[1]
assert 0, '%r raised %r, not %r' % (func, e, exc) assert 0, '%r raised %r, not %r' % (func, e, exc)
assert 0, '%r did not raise %r' % (func, exc) assert 0, '%r did not raise %r' % (func, exc)

Loading…
Cancel
Save