tests: log original traceback in assertRaises().

This commit is contained in:
David Wilson 2018-07-04 17:38:18 +00:00
parent ff2f44b046
commit 46ec0ffcaf
1 changed files with 2 additions and 0 deletions

View File

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