micropython/tests/extmod/asyncio_get_event_loop.py
Damien George 2e852522b1 tests/extmod: Add .exp test files for asyncio.get_event_loop tests.
And use `asyncio.new_event_loop()` where possible.  This change is needed
because CPython 3.12 deprecated the `get_event_loop()` function.

Signed-off-by: Damien George <damien@micropython.org>
2024-05-27 13:56:55 +10:00

19 lines
330 B
Python

# Test get_event_loop()
# Note: CPython deprecated get_event_loop() so this test needs a .exp
try:
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
async def main():
print("start")
await asyncio.sleep(0.01)
print("end")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())