()
| 58 | |
| 59 | |
| 60 | def thread_exception_runtest_hook() -> Generator[None, None, None]: |
| 61 | with catch_threading_exception() as cm: |
| 62 | yield |
| 63 | if cm.args: |
| 64 | thread_name = "<unknown>" if cm.args.thread is None else cm.args.thread.name |
| 65 | msg = f"Exception in thread {thread_name}\n\n" |
| 66 | msg += "".join( |
| 67 | traceback.format_exception( |
| 68 | cm.args.exc_type, |
| 69 | cm.args.exc_value, |
| 70 | cm.args.exc_traceback, |
| 71 | ) |
| 72 | ) |
| 73 | warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg)) |
| 74 | |
| 75 | |
| 76 | @pytest.hookimpl(hookwrapper=True, trylast=True) |
no test coverage detected