MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_unraisable_exception

Method test_unraisable_exception

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

Source from the content-addressed store, hash-verified

136 self.assertEqual(thread._count(), orig)
137
138 def test_unraisable_exception(self):
139 def task():
140 started.release()
141 raise ValueError("task failed")
142
143 started = thread.allocate_lock()
144 with support.catch_unraisable_exception() as cm:
145 with threading_helper.wait_threads_exit():
146 started.acquire()
147 thread.start_new_thread(task, ())
148 started.acquire()
149
150 self.assertEqual(str(cm.unraisable.exc_value), "task failed")
151 self.assertIs(cm.unraisable.object, task)
152 self.assertEqual(cm.unraisable.err_msg,
153 "Exception ignored in thread started by")
154 self.assertIsNotNone(cm.unraisable.exc_traceback)
155
156
157class Barrier:

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected