diff options
author | Damien George <damien@micropython.org> | 2025-09-14 11:50:29 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-10-01 23:59:05 +1000 |
commit | a3a2b9e9738332eb9033bc1c227c9a69e9476e97 (patch) | |
tree | e8bcfdd91e53cd7a9afdff73c9505a4ee025c71b | |
parent | c176fe8702cd806cbd0981234a4d7328e37b1673 (diff) |
tests/extmod: Improve skip detection of extmod tests.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r-- | tests/extmod/machine_soft_timer.py | 12 | ||||
-rw-r--r-- | tests/extmod/select_poll_custom.py | 4 | ||||
-rw-r--r-- | tests/extmod/tls_threads.py | 3 | ||||
-rw-r--r-- | tests/extmod/vfs_fat_ilistdir_del.py | 3 | ||||
-rw-r--r-- | tests/extmod/vfs_lfs_ilistdir_del.py | 3 | ||||
-rw-r--r-- | tests/extmod/vfs_posix_ilistdir_del.py | 3 |
6 files changed, 12 insertions, 16 deletions
diff --git a/tests/extmod/machine_soft_timer.py b/tests/extmod/machine_soft_timer.py index 1e9c66aa2..aa19becd8 100644 --- a/tests/extmod/machine_soft_timer.py +++ b/tests/extmod/machine_soft_timer.py @@ -1,20 +1,18 @@ # test "soft" machine.Timer (no hardware ID) import sys - -if sys.platform in ("esp32", "esp8266"): - print("SKIP") # TODO: Implement soft timers for esp32/esp8266 ports - raise SystemExit - - try: - import time, machine as machine + import time, machine machine.Timer except: print("SKIP") raise SystemExit +if sys.platform in ("esp32", "esp8266"): + print("SKIP") # TODO: Implement soft timers for esp32/esp8266 ports + raise SystemExit + # create and deinit t = machine.Timer(freq=1) t.deinit() diff --git a/tests/extmod/select_poll_custom.py b/tests/extmod/select_poll_custom.py index b854a8a14..0d2ab07b2 100644 --- a/tests/extmod/select_poll_custom.py +++ b/tests/extmod/select_poll_custom.py @@ -1,13 +1,13 @@ # Test custom pollable objects implemented in Python. -from micropython import const - try: import socket, select, io except ImportError: print("SKIP") raise SystemExit +from micropython import const + _MP_STREAM_POLL = const(3) _MP_STREAM_GET_FILENO = const(10) diff --git a/tests/extmod/tls_threads.py b/tests/extmod/tls_threads.py index 4564abd3d..1e0c3d23d 100644 --- a/tests/extmod/tls_threads.py +++ b/tests/extmod/tls_threads.py @@ -1,6 +1,5 @@ # Ensure that SSL sockets can be allocated from multiple # threads without thread safety issues -import unittest try: import _thread @@ -11,6 +10,8 @@ except ImportError: print("SKIP") raise SystemExit +import unittest + class TestSocket(io.IOBase): def write(self, buf): diff --git a/tests/extmod/vfs_fat_ilistdir_del.py b/tests/extmod/vfs_fat_ilistdir_del.py index a6e24ec92..964e6b128 100644 --- a/tests/extmod/vfs_fat_ilistdir_del.py +++ b/tests/extmod/vfs_fat_ilistdir_del.py @@ -1,8 +1,7 @@ # Test ilistdir __del__ for VfsFat using a RAM device. -import gc try: - import os, vfs + import gc, os, vfs vfs.VfsFat except (ImportError, AttributeError): diff --git a/tests/extmod/vfs_lfs_ilistdir_del.py b/tests/extmod/vfs_lfs_ilistdir_del.py index f463b84b2..828c85a25 100644 --- a/tests/extmod/vfs_lfs_ilistdir_del.py +++ b/tests/extmod/vfs_lfs_ilistdir_del.py @@ -1,8 +1,7 @@ # Test ilistdir __del__ for VfsLittle using a RAM device. -import gc try: - import vfs + import gc, vfs vfs.VfsLfs2 except (ImportError, AttributeError): diff --git a/tests/extmod/vfs_posix_ilistdir_del.py b/tests/extmod/vfs_posix_ilistdir_del.py index 78d7c854c..8b5984cd8 100644 --- a/tests/extmod/vfs_posix_ilistdir_del.py +++ b/tests/extmod/vfs_posix_ilistdir_del.py @@ -1,8 +1,7 @@ # Test ilistdir __del__ for VfsPosix. -import gc try: - import os, vfs + import gc, os, vfs vfs.VfsPosix except (ImportError, AttributeError): |