Skip to content

Commit 2e85252

Browse files
committed
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>
1 parent 1ea06b9 commit 2e85252

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

tests/extmod/asyncio_get_event_loop.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Test get_event_loop()
2+
# Note: CPython deprecated get_event_loop() so this test needs a .exp
23

34
try:
45
import asyncio
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
start
2+
end

tests/extmod/asyncio_loop_stop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def main():
3434
loop.stop()
3535

3636

37-
loop = asyncio.get_event_loop()
37+
loop = asyncio.new_event_loop()
3838
loop.create_task(main())
3939

4040
for i in range(3):

tests/extmod/asyncio_new_event_loop.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Test Loop.new_event_loop()
2+
# Note: CPython deprecated get_event_loop() so this test needs a .exp
23

34
try:
45
import asyncio
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
start
2+
task 0
3+
stop
4+
start
5+
task 0
6+
stop

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy