def test_explicit_reactor_coroutine(framework):
"""
If we set an event-loop, Futures + Tasks should use it.
"""
pytest.importorskip('asyncio')
if txaio.using_twisted:
pytest.skip()
from asyncio import coroutine
@coroutine
def some_coroutine():
yield 'nothing'
with patch.object(txaio.config, 'loop') as fake_loop:
txaio.as_future(some_coroutine)
assert len(fake_loop.method_calls) == 2
c = fake_loop.method_calls[1]
assert c[0] == 'call_soon'
评论列表
文章目录