def test_exception_non_waited_job(make_scheduler, loop):
exc_handler = mock.Mock()
scheduler = await make_scheduler(exception_handler=exc_handler)
exc = RuntimeError()
async def coro():
await asyncio.sleep(0, loop=loop)
raise exc
await scheduler.spawn(coro())
assert len(scheduler) == 1
await asyncio.sleep(0.05, loop=loop)
assert len(scheduler) == 0
expect = {'exception': exc,
'job': mock.ANY,
'message': 'Job processing failed'}
if loop.get_debug():
expect['source_traceback'] = mock.ANY
exc_handler.assert_called_with(scheduler, expect)
评论列表
文章目录