def coroutine_test(coro):
    """Decorator to create a coroutine that starts and stops its own loop."""
    def wrapper(*args, **kwargs):
        future = coro(*args, **kwargs)
        loop = asyncio.new_event_loop()
        loop.run_until_complete(future)
    return wrapper
Decorator to create a coroutine that starts and stops its own loop.
hangups/test/test_event.py