Skip to content

Commit

Permalink
filter tracebacks (a bit)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejgroene committed Nov 13, 2024
1 parent fe17a18 commit 781c9a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion selftest/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import sys # maxsize
import io # formatting tests

from .utils import filter_traceback

logger = logging.getLogger("selftest")
# in order to have tests shown when logging is unconfigured, we log at a level slightly
Expand Down Expand Up @@ -178,7 +179,11 @@ def _run(self, test_func, *app_args, **app_kwds):
self._logtest(
orig_test_func, orig_test_func.__qualname__
) # TODO pass test func?
test_func(*app_args, **app_kwds)
try:
test_func(*app_args, **app_kwds)
except Exception as e:
e.__traceback__ = filter_traceback(e.__traceback__)
raise e from None
return orig_test_func if self.option_get("keep") else None

def log_stats(self):
Expand Down

0 comments on commit 781c9a9

Please sign in to comment.