MCPcopy Index your code
hub / github.com/python/cpython / test_unraisable_exception

Method test_unraisable_exception

Lib/test/test_thread.py:153–169  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

151 self.assertEqual(thread._count(), orig)
152
153 def test_unraisable_exception(self):
154 def task():
155 started.release()
156 raise ValueError("task failed")
157
158 started = thread.allocate_lock()
159 with support.catch_unraisable_exception() as cm:
160 with threading_helper.wait_threads_exit():
161 started.acquire()
162 thread.start_new_thread(task, ())
163 started.acquire()
164
165 self.assertEqual(str(cm.unraisable.exc_value), "task failed")
166 self.assertIsNone(cm.unraisable.object)
167 self.assertEqual(cm.unraisable.err_msg,
168 f"Exception ignored in thread started by {task!r}")
169 self.assertIsNotNone(cm.unraisable.exc_traceback)
170
171 def test_join_thread(self):
172 finished = []

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
assertIsNoneMethod · 0.80
assertIsNotNoneMethod · 0.80
acquireMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected