]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Separated mcp-specific subparts of DigitalInOut testcase
authorCefn Hoile <github.com@cefn.com>
Sun, 18 Feb 2018 01:27:18 +0000 (01:27 +0000)
committerCefn Hoile <github.com@cefn.com>
Sun, 18 Feb 2018 01:27:18 +0000 (01:27 +0000)
python/testing/platform/mcp/digitalio.py [new file with mode: 0644]

diff --git a/python/testing/platform/mcp/digitalio.py b/python/testing/platform/mcp/digitalio.py
new file mode 100644 (file)
index 0000000..adbabe0
--- /dev/null
@@ -0,0 +1,26 @@
+"""
+    Tests which require an embedded platform (with actual hardware bindings)
+    but which are not architecture-specific.
+"""
+import unittest
+import agnostic
+import board
+
+if agnostic.board == "feather_m0_express":
+    LEDPIN = board.D13
+else:
+    raise NameError("No LED for {}".format(agnostic.platform))
+
+class TestDigitalInOut(unittest.TestCase):
+
+
+    def test_context_manager(self):
+        """Deinitialisation is triggered by __exit__()"""
+        dio = create_pin()
+        self.assertIsNotNone(dio._pin)
+        with dio:
+            pass
+        self.assertIsNone(dio._pin)
+
+def main():
+    unittest.main()