From 46ec0ffcaf3896f4af85d08ec67f5ba936421c27 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 4 Jul 2018 17:38:18 +0000 Subject: [PATCH] tests: log original traceback in assertRaises(). --- tests/testlib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/testlib.py b/tests/testlib.py index 008a3dc0..d812609c 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -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)