(self)
| 2185 | @support.cpython_only |
| 2186 | @force_not_colorized |
| 2187 | def test_excepthook_thread_None(self): |
| 2188 | # threading.excepthook called with thread=None: log the thread |
| 2189 | # identifier in this case. |
| 2190 | with support.captured_output("stderr") as stderr: |
| 2191 | try: |
| 2192 | raise ValueError("bug") |
| 2193 | except Exception as exc: |
| 2194 | args = threading.ExceptHookArgs([*sys.exc_info(), None]) |
| 2195 | try: |
| 2196 | threading.excepthook(args) |
| 2197 | finally: |
| 2198 | # Explicitly break a reference cycle |
| 2199 | args = None |
| 2200 | |
| 2201 | stderr = stderr.getvalue().strip() |
| 2202 | self.assertIn(f'Exception in thread {threading.get_ident()}:\n', stderr) |
| 2203 | self.assertIn('Traceback (most recent call last):\n', stderr) |
| 2204 | self.assertIn(' raise ValueError("bug")', stderr) |
| 2205 | self.assertIn('ValueError: bug', stderr) |
| 2206 | |
| 2207 | def test_system_exit(self): |
| 2208 | class ThreadExit(threading.Thread): |
nothing calls this directly
no test coverage detected