From ca39ea7cef802497834aa2a0afa0ef8cae9ab800 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 28 Apr 2019 22:12:17 +1000 Subject: [PATCH] tests: Skip tests needing machine module if (u)machine doesn't exist. --- tests/basics/subclass_native_call.py | 10 +++++----- tests/extmod/machine_pinbase.py | 10 +++++----- tests/extmod/machine_pulse.py | 10 +++++----- tests/extmod/machine_signal.py | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/basics/subclass_native_call.py b/tests/basics/subclass_native_call.py index c645575225..969f0a415e 100644 --- a/tests/basics/subclass_native_call.py +++ b/tests/basics/subclass_native_call.py @@ -4,13 +4,13 @@ # and is callable (has call). The only one available is machine.Signal, which # in turns needs PinBase. try: - import umachine as machine -except ImportError: - import machine -try: + try: + import umachine as machine + except ImportError: + import machine machine.PinBase machine.Signal -except AttributeError: +except: print("SKIP") raise SystemExit diff --git a/tests/extmod/machine_pinbase.py b/tests/extmod/machine_pinbase.py index e91775504d..45aa4d8b5b 100644 --- a/tests/extmod/machine_pinbase.py +++ b/tests/extmod/machine_pinbase.py @@ -1,10 +1,10 @@ try: - import umachine as machine -except ImportError: - import machine -try: + try: + import umachine as machine + except ImportError: + import machine machine.PinBase -except AttributeError: +except: print("SKIP") raise SystemExit diff --git a/tests/extmod/machine_pulse.py b/tests/extmod/machine_pulse.py index d525974e0c..458fe09a11 100644 --- a/tests/extmod/machine_pulse.py +++ b/tests/extmod/machine_pulse.py @@ -1,11 +1,11 @@ try: - import umachine as machine -except ImportError: - import machine -try: + try: + import umachine as machine + except ImportError: + import machine machine.PinBase machine.time_pulse_us -except AttributeError: +except: print("SKIP") raise SystemExit diff --git a/tests/extmod/machine_signal.py b/tests/extmod/machine_signal.py index 53f4f5890c..dcc0de1a5d 100644 --- a/tests/extmod/machine_signal.py +++ b/tests/extmod/machine_signal.py @@ -1,13 +1,13 @@ # test machine.Signal class try: - import umachine as machine -except ImportError: - import machine -try: + try: + import umachine as machine + except ImportError: + import machine machine.PinBase machine.Signal -except AttributeError: +except: print("SKIP") raise SystemExit