summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/asyncio_wait_task.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extmod/asyncio_wait_task.py')
-rw-r--r--tests/extmod/asyncio_wait_task.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/extmod/asyncio_wait_task.py b/tests/extmod/asyncio_wait_task.py
index bce426d971..7d79104f8c 100644
--- a/tests/extmod/asyncio_wait_task.py
+++ b/tests/extmod/asyncio_wait_task.py
@@ -68,5 +68,16 @@ async def main():
except ValueError:
print("ValueError")
+ # Wait on a task that raises, but the waiting is done some time later.
+ # Need to suppress the "Task exception wasn't retrieved" message.
+ asyncio.get_event_loop().set_exception_handler(lambda loop, context: None)
+ t = asyncio.create_task(task_raise())
+ for _ in range(5):
+ await asyncio.sleep(0)
+ try:
+ await t
+ except ValueError:
+ print("ValueError")
+
asyncio.run(main())