test_call_later.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:deb-python-txaio 作者: openstack 项目源码 文件源码
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'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号