summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/extmod/time_res.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/extmod/time_res.py b/tests/extmod/time_res.py
index 548bef1f1..ef20050b9 100644
--- a/tests/extmod/time_res.py
+++ b/tests/extmod/time_res.py
@@ -37,9 +37,12 @@ def test():
time.sleep_ms(100)
for func_name, _ in EXPECTED_MAP:
try:
- time_func = getattr(time, func_name, None) or globals()[func_name]
+ if func_name.endswith("_time"):
+ time_func = globals()[func_name]
+ else:
+ time_func = getattr(time, func_name)
now = time_func() # may raise AttributeError
- except (KeyError, AttributeError):
+ except AttributeError:
continue
try:
results_map[func_name].add(now)