From 9a37e2feb93079dc3154db3f891d21e4fd80b0fa Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 15 Sep 2025 13:41:10 +1000 Subject: [PATCH] tests/ports/unix: Improve skip detection for os.getenv and time module. Signed-off-by: Damien George --- tests/ports/unix/mod_os.py | 3 +++ tests/ports/unix/time_mktime_localtime.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/ports/unix/mod_os.py b/tests/ports/unix/mod_os.py index f69fa45b2b..468f6badd1 100644 --- a/tests/ports/unix/mod_os.py +++ b/tests/ports/unix/mod_os.py @@ -1,6 +1,9 @@ # This module is not entirely compatible with CPython import os +if not hasattr(os, "getenv"): + print("SKIP") + raise SystemExit os.putenv("TEST_VARIABLE", "TEST_VALUE") diff --git a/tests/ports/unix/time_mktime_localtime.py b/tests/ports/unix/time_mktime_localtime.py index d1c03c103d..df5d6cda69 100644 --- a/tests/ports/unix/time_mktime_localtime.py +++ b/tests/ports/unix/time_mktime_localtime.py @@ -1,4 +1,8 @@ -import time +try: + import time +except ImportError: + print("SKIP") + raise SystemExit DAYS_PER_MONTH = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]