Ejemplo n.º 1
0
 async def worker():
     with timeout(loop, 1):
         try:
             await asyncio.sleep(2)
         except asyncio.CancelledError:
             cleanup.set()
             raise
Ejemplo n.º 2
0
 async def worker():
     with timeout(loop, 1):
         try:
             await asyncio.sleep(2)
         except asyncio.CancelledError:
             # Swallow the exception
             pass
     ignored.set()
Ejemplo n.º 3
0
 async def worker():
     with timeout(loop, 2):
         raise Exception('inner')
Ejemplo n.º 4
0
 async def worker():
     with timeout(loop, 1):
         await asyncio.sleep(0.5)