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>
This commit is contained in:
parent
1ea06b99d8
commit
2e852522b1
5 changed files with 11 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
# Test get_event_loop()
|
||||
# Note: CPython deprecated get_event_loop() so this test needs a .exp
|
||||
|
||||
try:
|
||||
import asyncio
|
||||
|
|
|
|||
2
tests/extmod/asyncio_get_event_loop.py.exp
Normal file
2
tests/extmod/asyncio_get_event_loop.py.exp
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
start
|
||||
end
|
||||
|
|
@ -34,7 +34,7 @@ async def main():
|
|||
loop.stop()
|
||||
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop = asyncio.new_event_loop()
|
||||
loop.create_task(main())
|
||||
|
||||
for i in range(3):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# Test Loop.new_event_loop()
|
||||
# Note: CPython deprecated get_event_loop() so this test needs a .exp
|
||||
|
||||
try:
|
||||
import asyncio
|
||||
|
|
|
|||
6
tests/extmod/asyncio_new_event_loop.py.exp
Normal file
6
tests/extmod/asyncio_new_event_loop.py.exp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
start
|
||||
task 0
|
||||
stop
|
||||
start
|
||||
task 0
|
||||
stop
|
||||
Loading…
Reference in a new issue