async def test_sets_traceback(self, event_loop): event_loop.set_debug(True) task = context.task_factory(event_loop, dummy()) task.cancel() assert isinstance(task._source_traceback, traceback.StackSummary)
async def test_propagates_context(self, event_loop): context.set('key', 'value') task = context.task_factory(event_loop, dummy()) task.cancel() assert task.context == {'key': 'value'}
async def test_sets_empty_context(self, event_loop): task = context.task_factory(event_loop, dummy()) task.cancel() assert task.context == {}
def test_closed_loop(self, event_loop): event_loop.close() with pytest.raises(RuntimeError): context.task_factory(event_loop, dummy())