def test_async_timeout(loop): with pytest.raises(asyncio.TimeoutError): async with timeout(0.01, loop=loop) as cm: await asyncio.sleep(10, loop=loop) assert cm.expired