U
    I|j¾  ã                   @   s$   d dl Z d dlmZ edd„ ƒZdS )é    N)Úcontextmanagerc                 c   s"   t jj}| t j_| V  |t j_dS )aÆ  
    This is a context-manager that sets the txaio event-loop to the
    one supplied temporarily. It's up to you to ensure you pass an
    event_loop or a reactor instance depending upon asyncio/Twisted.

    Use like so:

    .. sourcecode:: python

        from twisted.internet import task
        with replace_loop(task.Clock()) as fake_reactor:
            f = txaio.call_later(5, foo)
            fake_reactor.advance(10)
            # ...etc
    N)ÚtxaioÚconfigZloop)Znew_loopÚorig© r   ú2/tmp/pip-unpacked-wheel-62jc6lv3/txaio/testutil.pyÚreplace_loop   s    r   )r   Ú
contextlibr   r   r   r   r   r   Ú<module>   s   