Skip to content

Commit

Permalink
tests, hook for exceptions only in debug mode (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz authored Sep 10, 2021
1 parent 480d125 commit 44637ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/_setup_test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,14 @@ def _try_hook_into_tests():
Also see: https://youtrack.jetbrains.com/issue/PY-9848
"""
# get TestProgram instance from stack...
# Check if this is run inside a debugger. Skip if this is not the case.
import sys
get_trace = getattr(sys, "gettrace", None)
if not get_trace:
return
if get_trace() is None:
return
# get TestProgram instance from stack...
from unittest import TestProgram
from better_exchook import get_current_frame
frame = get_current_frame()
Expand Down

0 comments on commit 44637ed

Please sign in to comment.