Skip to content

Commit 2322d37

Browse files
committed
tests/extmod_hardware/machine_counter.py: Separate the connection test.
Because it requires a different configuration of the pins (in `setUp`). Eg on mimxrt pins used for a `machine.Counter` cannot be read. Signed-off-by: Damien George <damien@micropython.org>
1 parent 43d38d9 commit 2322d37

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

tests/extmod_hardware/machine_counter.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ def toggle(times):
3737
out_pin(0)
3838

3939

40+
class TestConnections(unittest.TestCase):
41+
def setUp(self):
42+
in_pin.init(Pin.IN)
43+
44+
def test_connections(self):
45+
# Test the hardware connections are correct. If this test fails, all tests will fail.
46+
out_pin(1)
47+
self.assertEqual(1, in_pin())
48+
out_pin(0)
49+
self.assertEqual(0, in_pin())
50+
51+
4052
class TestCounter(unittest.TestCase):
4153
def setUp(self):
4254
out_pin(0)
@@ -48,14 +60,6 @@ def tearDown(self):
4860
def assertCounter(self, value):
4961
self.assertEqual(self.counter.value(), value)
5062

51-
@unittest.skipIf(sys.platform == "mimxrt", "cannot read back the pin")
52-
def test_connections(self):
53-
# Test the hardware connections are correct. If this test fails, all tests will fail.
54-
out_pin(1)
55-
self.assertEqual(1, in_pin())
56-
out_pin(0)
57-
self.assertEqual(0, in_pin())
58-
5963
def test_count_rising(self):
6064
self.assertCounter(0)
6165
toggle(100)

0 commit comments

Comments
 (0)