summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/uasyncio_micropython.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-06-08 16:01:38 +1000
committerDamien George <damien@micropython.org>2023-06-19 17:33:03 +1000
commit6027c41c8f5b8f1a9e7b85b2bb93b3e6f2718e54 (patch)
tree08f41a4d0cd48fa5c0bc49519832ac2faba6923a /tests/extmod/uasyncio_micropython.py
parent2fbc08c462e247e7f78460783c9a07c76c5b762e (diff)
downloadmicropython-6027c41c8f5b8f1a9e7b85b2bb93b3e6f2718e54.tar.gz
micropython-6027c41c8f5b8f1a9e7b85b2bb93b3e6f2718e54.zip
tests: Rename uasyncio to asyncio.
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tests/extmod/uasyncio_micropython.py')
-rw-r--r--tests/extmod/uasyncio_micropython.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/tests/extmod/uasyncio_micropython.py b/tests/extmod/uasyncio_micropython.py
deleted file mode 100644
index de1687ca8b..0000000000
--- a/tests/extmod/uasyncio_micropython.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Test MicroPython extensions on CPython asyncio:
-# - sleep_ms
-# - wait_for_ms
-
-try:
- import time, uasyncio
-except ImportError:
- print("SKIP")
- raise SystemExit
-
-
-async def task(id, t):
- print("task start", id)
- await uasyncio.sleep_ms(t)
- print("task end", id)
- return id * 2
-
-
-async def main():
- # Simple sleep_ms
- t0 = time.ticks_ms()
- await uasyncio.sleep_ms(1)
- print(time.ticks_diff(time.ticks_ms(), t0) < 100)
-
- try:
- # Sleep 1ms beyond maximum allowed sleep value
- await uasyncio.sleep_ms(time.ticks_add(0, -1) // 2 + 1)
- except OverflowError:
- print("OverflowError")
-
- # When task finished before the timeout
- print(await uasyncio.wait_for_ms(task(1, 5), 50))
-
- # When timeout passes and task is cancelled
- try:
- print(await uasyncio.wait_for_ms(task(2, 50), 5))
- except uasyncio.TimeoutError:
- print("timeout")
-
- print("finish")
-
-
-uasyncio.run(main())