commit b005d31362ddf6ba0d87d26482a596cf4a3dd475 Author: Damian Johnson atagar@torproject.org Date: Sun Feb 25 16:16:16 2018 -0800
Print full stacktrace when a test fails to import
Our tests preemptively import test modules so asynchronous tasks can register themselves. However, an import raises an exception then we only printed the error message, not the stacktrace complicating troubleshooting. --- test/task.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/test/task.py b/test/task.py index 20841be5..b28833bd 100644 --- a/test/task.py +++ b/test/task.py @@ -26,6 +26,7 @@ import os import re import sys import time +import traceback
import stem import stem.prereq @@ -92,7 +93,10 @@ def _import_tests(): return
for module in (CONFIG['test.unit_tests'].splitlines() + CONFIG['test.integ_tests'].splitlines()): - importlib.import_module(module.rsplit('.', 1)[0]) + try: + importlib.import_module(module.rsplit('.', 1)[0]) + except Exception as exc: + raise ImportError(traceback.format_exc())
def _check_for_unused_tests(paths):