From 6bb446b7ff62af6d3b6b10f2da0f6d107f97e00e Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 23 Jan 2024 11:11:25 +1100 Subject: [PATCH] tests/extmod: Remove asyncio .exp files that match CPython output. These were added back in commit c4935f30490d0446e16a51dbf7a6397b771cf804 because the tests required CPython 3.8, which was quite new at the time. But CPython 3.8 was released over 4 years ago (October 2019) and the CI test runners, and developers, have this (or a more recent) CPython version. Removing the .exp files also helps keep MicroPython semantics the same as CPython. The asyncio_fair.py test it adjusted slightly to have more deterministic timing and output. Signed-off-by: Damien George --- tests/extmod/asyncio_await_return.py.exp | 2 -- tests/extmod/asyncio_basic2.py.exp | 4 --- tests/extmod/asyncio_cancel_fair.py.exp | 24 -------------- tests/extmod/asyncio_cancel_fair2.py.exp | 8 ----- tests/extmod/asyncio_cancel_task.py.exp | 31 ----------------- .../asyncio_cancel_wait_on_finished.py.exp | 7 ---- tests/extmod/asyncio_current_task.py.exp | 1 - tests/extmod/asyncio_event.py.exp | 33 ------------------- tests/extmod/asyncio_event_fair.py.exp | 16 --------- tests/extmod/asyncio_exception.py.exp | 7 ---- tests/extmod/asyncio_fair.py | 2 +- tests/extmod/asyncio_fair.py.exp | 13 -------- tests/extmod/asyncio_lock.py | 4 +++ tests/extmod/asyncio_lock_cancel.py.exp | 11 ------- tests/extmod/asyncio_loop_stop.py.exp | 7 ---- tests/extmod/asyncio_new_event_loop.py.exp | 6 ---- .../asyncio_set_exception_handler.py.exp | 9 ----- tests/extmod/asyncio_task_done.py.exp | 24 -------------- 18 files changed, 5 insertions(+), 204 deletions(-) delete mode 100644 tests/extmod/asyncio_await_return.py.exp delete mode 100644 tests/extmod/asyncio_basic2.py.exp delete mode 100644 tests/extmod/asyncio_cancel_fair.py.exp delete mode 100644 tests/extmod/asyncio_cancel_fair2.py.exp delete mode 100644 tests/extmod/asyncio_cancel_task.py.exp delete mode 100644 tests/extmod/asyncio_cancel_wait_on_finished.py.exp delete mode 100644 tests/extmod/asyncio_current_task.py.exp delete mode 100644 tests/extmod/asyncio_event.py.exp delete mode 100644 tests/extmod/asyncio_event_fair.py.exp delete mode 100644 tests/extmod/asyncio_exception.py.exp delete mode 100644 tests/extmod/asyncio_fair.py.exp delete mode 100644 tests/extmod/asyncio_lock_cancel.py.exp delete mode 100644 tests/extmod/asyncio_loop_stop.py.exp delete mode 100644 tests/extmod/asyncio_new_event_loop.py.exp delete mode 100644 tests/extmod/asyncio_set_exception_handler.py.exp delete mode 100644 tests/extmod/asyncio_task_done.py.exp diff --git a/tests/extmod/asyncio_await_return.py.exp b/tests/extmod/asyncio_await_return.py.exp deleted file mode 100644 index daaac9e303..0000000000 --- a/tests/extmod/asyncio_await_return.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -42 -42 diff --git a/tests/extmod/asyncio_basic2.py.exp b/tests/extmod/asyncio_basic2.py.exp deleted file mode 100644 index 3ca3521728..0000000000 --- a/tests/extmod/asyncio_basic2.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -main start -forever start -main done -42 diff --git a/tests/extmod/asyncio_cancel_fair.py.exp b/tests/extmod/asyncio_cancel_fair.py.exp deleted file mode 100644 index 8f5da08e4c..0000000000 --- a/tests/extmod/asyncio_cancel_fair.py.exp +++ /dev/null @@ -1,24 +0,0 @@ -start 0 -start 1 -start 2 -done 0 -0 cancels 1 -start 0 -cancelled 1 -1 cancels 0 -start 1 -done 2 -start 2 -cancelled 0 -0 cancels 1 -start 0 -cancelled 1 -1 cancels 0 -start 1 -done 2 -start 2 -cancelled 0 -0 cancels 1 -cancelled 1 -1 cancels 0 -done 2 diff --git a/tests/extmod/asyncio_cancel_fair2.py.exp b/tests/extmod/asyncio_cancel_fair2.py.exp deleted file mode 100644 index e9dd649b45..0000000000 --- a/tests/extmod/asyncio_cancel_fair2.py.exp +++ /dev/null @@ -1,8 +0,0 @@ -sleep a -sleep b 0 -sleep b 1 -sleep b 2 -cancelled a -done b 0 -done b 1 -done b 2 diff --git a/tests/extmod/asyncio_cancel_task.py.exp b/tests/extmod/asyncio_cancel_task.py.exp deleted file mode 100644 index 031b94023f..0000000000 --- a/tests/extmod/asyncio_cancel_task.py.exp +++ /dev/null @@ -1,31 +0,0 @@ -True -task start -True -main sleep -task cancel -task start -True -True -True -True -main sleep -task cancel -main wait -main got CancelledError -task start -task done -False ----- -task 2 -task start -main cancel -main sleep -task cancel -task 2 cancel ----- -task 2 -task start -main cancel -main sleep -task cancel -task 2 done diff --git a/tests/extmod/asyncio_cancel_wait_on_finished.py.exp b/tests/extmod/asyncio_cancel_wait_on_finished.py.exp deleted file mode 100644 index 60e871bfe5..0000000000 --- a/tests/extmod/asyncio_cancel_wait_on_finished.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -main sleep -sleep_task sleep -wait_task wait -main sleep -sleep_task wake -main wait -CancelledError() diff --git a/tests/extmod/asyncio_current_task.py.exp b/tests/extmod/asyncio_current_task.py.exp deleted file mode 100644 index 0ca95142bb..0000000000 --- a/tests/extmod/asyncio_current_task.py.exp +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/tests/extmod/asyncio_event.py.exp b/tests/extmod/asyncio_event.py.exp deleted file mode 100644 index 3188f291e5..0000000000 --- a/tests/extmod/asyncio_event.py.exp +++ /dev/null @@ -1,33 +0,0 @@ -False -True -False ----- -yield -start 1 -start 2 -set event -yield -True -end 1 -True -end 2 ----- -yield -start 3 -True -end 3 ----- -clear event -start 4 -set event -True -end 4 ----- -start 5 ----- -start 6 ----- -set event ----- -TimeoutError -set event diff --git a/tests/extmod/asyncio_event_fair.py.exp b/tests/extmod/asyncio_event_fair.py.exp deleted file mode 100644 index fe2e3d6e47..0000000000 --- a/tests/extmod/asyncio_event_fair.py.exp +++ /dev/null @@ -1,16 +0,0 @@ -sleep 0 -wait 2 -sleep 1 -wait 3 -sleep 0 -sleep 1 -wait 2 -sleep 0 -sleep 1 -wait 3 -sleep 0 -sleep 1 -wait 2 -wait 3 -wait 2 -wait 3 diff --git a/tests/extmod/asyncio_exception.py.exp b/tests/extmod/asyncio_exception.py.exp deleted file mode 100644 index b2ee860170..0000000000 --- a/tests/extmod/asyncio_exception.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -main start -ValueError 1 -main start -task start -ValueError 2 -main start -ValueError 3 diff --git a/tests/extmod/asyncio_fair.py b/tests/extmod/asyncio_fair.py index 43076fef1d..3e3ac04735 100644 --- a/tests/extmod/asyncio_fair.py +++ b/tests/extmod/asyncio_fair.py @@ -20,7 +20,7 @@ async def main(): t2 = asyncio.create_task(task(2, 0.1)) t3 = asyncio.create_task(task(3, 0.18)) t4 = asyncio.create_task(task(4, -100)) - await asyncio.sleep(0.5) + await asyncio.sleep(0.45) # t2 prints 5 times, t3 prints 3 times t1.cancel() t2.cancel() t3.cancel() diff --git a/tests/extmod/asyncio_fair.py.exp b/tests/extmod/asyncio_fair.py.exp deleted file mode 100644 index b4b6481db0..0000000000 --- a/tests/extmod/asyncio_fair.py.exp +++ /dev/null @@ -1,13 +0,0 @@ -task start 1 -task start 2 -task work 2 -task start 3 -task work 3 -task start 4 -task work 2 -task work 3 -task work 2 -task work 2 -task work 3 -task work 2 -finish diff --git a/tests/extmod/asyncio_lock.py b/tests/extmod/asyncio_lock.py index f565adb03f..10d3285be0 100644 --- a/tests/extmod/asyncio_lock.py +++ b/tests/extmod/asyncio_lock.py @@ -1,4 +1,8 @@ # Test Lock class +# +# This test has a corresponding .exp file because it tests a very specific ordering of +# events when cancelling a task waiting on a lock, and that ordering should not change +# (even though it does match CPython's output). try: import asyncio diff --git a/tests/extmod/asyncio_lock_cancel.py.exp b/tests/extmod/asyncio_lock_cancel.py.exp deleted file mode 100644 index 49ae253887..0000000000 --- a/tests/extmod/asyncio_lock_cancel.py.exp +++ /dev/null @@ -1,11 +0,0 @@ -task 0 start -task 1 start -task 2 start -task 3 start -task 1 cancel -task 2 cancel -task 0 lock_flag False -task 0 done -task 3 lock_flag False -task 3 done -False diff --git a/tests/extmod/asyncio_loop_stop.py.exp b/tests/extmod/asyncio_loop_stop.py.exp deleted file mode 100644 index bada5f0d84..0000000000 --- a/tests/extmod/asyncio_loop_stop.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -run 0 -start -sleep -run 1 -run 2 -task -end diff --git a/tests/extmod/asyncio_new_event_loop.py.exp b/tests/extmod/asyncio_new_event_loop.py.exp deleted file mode 100644 index 9e104fda39..0000000000 --- a/tests/extmod/asyncio_new_event_loop.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -start -task 0 -stop -start -task 0 -stop diff --git a/tests/extmod/asyncio_set_exception_handler.py.exp b/tests/extmod/asyncio_set_exception_handler.py.exp deleted file mode 100644 index fb4711469d..0000000000 --- a/tests/extmod/asyncio_set_exception_handler.py.exp +++ /dev/null @@ -1,9 +0,0 @@ -None -True -sleep -custom_handler ValueError(0, 1) -sleep -custom_handler ValueError(1, 2) -custom_handler ValueError(2, 3) -ValueError(3, 4) -done diff --git a/tests/extmod/asyncio_task_done.py.exp b/tests/extmod/asyncio_task_done.py.exp deleted file mode 100644 index ddda04c5ec..0000000000 --- a/tests/extmod/asyncio_task_done.py.exp +++ /dev/null @@ -1,24 +0,0 @@ -========== -False -task start -task done -True -True -========== -False -task start -False -task done -True -========== -False -task start -True -ValueError() -True -========== -False -task start -False -ValueError() -True