summaryrefslogtreecommitdiff
path: root/tests/extmod/uasyncio_gather.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-05-03 22:39:58 +1000
committerDamien George <damien@micropython.org>2022-05-03 22:53:12 +1000
commitc90f097519c7342a128848bf9dc5b38ba75d4222 (patch)
treedf9c67263d9fa2cd3c7d97f893147825a2a22e1c /tests/extmod/uasyncio_gather.py
parent0e7bfc88c6ac6b5d64240f91183a3cfe2ab67ade (diff)
tests/extmod: Increase timing on uasyncio tests to make more reliable.
Non-real-time systems like Windows, Linux and macOS do not have reliable timing, so increase the sleep intervals to make these tests more likely to pass. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/extmod/uasyncio_gather.py')
-rw-r--r--tests/extmod/uasyncio_gather.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/extmod/uasyncio_gather.py b/tests/extmod/uasyncio_gather.py
index fb47e753f..c081221c9 100644
--- a/tests/extmod/uasyncio_gather.py
+++ b/tests/extmod/uasyncio_gather.py
@@ -20,7 +20,7 @@ async def factorial(name, number):
return f
-async def task(id, t=0.02):
+async def task(id, t=0.1):
print("start", id)
await asyncio.sleep(t)
print("end", id)
@@ -30,11 +30,11 @@ async def task(id, t=0.02):
async def task_loop(id):
print("task_loop start", id)
while True:
- await asyncio.sleep(0.02)
+ await asyncio.sleep(0.1)
print("task_loop loop", id)
-async def task_raise(id, t=0.02):
+async def task_raise(id, t=0.1):
print("task_raise start", id)
await asyncio.sleep(t)
print("task_raise raise", id)
@@ -75,7 +75,7 @@ async def main():
print(tasks[0].done(), tasks[1].done())
for t in tasks:
t.cancel()
- await asyncio.sleep(0.04)
+ await asyncio.sleep(0.2)
print("====")
@@ -92,9 +92,9 @@ async def main():
# Cancel a multi gather.
t = asyncio.create_task(gather_task(task(1), task(2)))
- await asyncio.sleep(0.01)
+ await asyncio.sleep(0.05)
t.cancel()
- await asyncio.sleep(0.04)
+ await asyncio.sleep(0.2)
# Test edge cases where the gather is cancelled just as tasks are created and ending.
for i in range(1, 4):