_asyncio.py 363 B

1234567891011121314151617
  1. """test utilities that use async/await syntax
  2. a separate file to avoid syntax errors on Python 2
  3. """
  4. import asyncio
  5. def async_func():
  6. """Simple async function to schedule a task on the current eventloop"""
  7. loop = asyncio.get_event_loop()
  8. assert loop.is_running()
  9. async def task():
  10. await asyncio.sleep(1)
  11. loop.create_task(task())