summaryrefslogtreecommitdiff
path: root/tests/extmod/asyncio_current_task.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-02-26 10:52:12 +1100
committerDamien George <damien@micropython.org>2024-02-28 15:48:51 +1100
commit8692d2602a7775fea22d75ebf5b50971dc2b968f (patch)
treefe844a4c454c261adf0c7d25e30b25817e9d475f /tests/extmod/asyncio_current_task.py
parent8fdcc25eb07731a64077b7576c5d477cf81e2dd5 (diff)
extmod/asyncio: Make current_task raise exception when there is no task.
Matches CPython behaviour. Fixes issue #11530. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/extmod/asyncio_current_task.py')
-rw-r--r--tests/extmod/asyncio_current_task.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/extmod/asyncio_current_task.py b/tests/extmod/asyncio_current_task.py
index 18058230f..a25e543d0 100644
--- a/tests/extmod/asyncio_current_task.py
+++ b/tests/extmod/asyncio_current_task.py
@@ -19,4 +19,15 @@ async def main():
print(t is result[0])
+try:
+ print(asyncio.current_task())
+except RuntimeError:
+ print("RuntimeError")
+
+
asyncio.run(main())
+
+try:
+ print(asyncio.current_task())
+except RuntimeError:
+ print("RuntimeError")