MCPcopy Create free account
hub / github.com/EasyIME/PIME / test_multi_exceptions

Method test_multi_exceptions

python/python3/tornado/test/gen_test.py:185–210  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

183
184 @gen_test
185 def test_multi_exceptions(self):
186 with ExpectLog(app_log, "Multiple exceptions in yield list"):
187 with self.assertRaises(RuntimeError) as cm:
188 yield gen.Multi(
189 [
190 self.async_exception(RuntimeError("error 1")),
191 self.async_exception(RuntimeError("error 2")),
192 ]
193 )
194 self.assertEqual(str(cm.exception), "error 1")
195
196 # With only one exception, no error is logged.
197 with self.assertRaises(RuntimeError):
198 yield gen.Multi(
199 [self.async_exception(RuntimeError("error 1")), self.async_future(2)]
200 )
201
202 # Exception logging may be explicitly quieted.
203 with self.assertRaises(RuntimeError):
204 yield gen.Multi(
205 [
206 self.async_exception(RuntimeError("error 1")),
207 self.async_exception(RuntimeError("error 2")),
208 ],
209 quiet_exceptions=RuntimeError,
210 )
211
212 @gen_test
213 def test_multi_future_exceptions(self):

Callers

nothing calls this directly

Calls 3

async_exceptionMethod · 0.95
async_futureMethod · 0.95
ExpectLogClass · 0.90

Tested by

no test coverage detected