示例#1
0
    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)
示例#2
0
    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'}
示例#3
0
    async def test_sets_empty_context(self, event_loop):
        task = context.task_factory(event_loop, dummy())
        task.cancel()

        assert task.context == {}
示例#4
0
 def test_closed_loop(self, event_loop):
     event_loop.close()
     with pytest.raises(RuntimeError):
         context.task_factory(event_loop, dummy())