]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - test/src/testing/implementation/micropython/digitalio.py
Moved testing out of top level python path
[Adafruit_Blinka-hackapet.git] / test / src / testing / implementation / micropython / digitalio.py
diff --git a/test/src/testing/implementation/micropython/digitalio.py b/test/src/testing/implementation/micropython/digitalio.py
new file mode 100644 (file)
index 0000000..05f7e42
--- /dev/null
@@ -0,0 +1,21 @@
+"""
+    Tests which require an embedded platform (with actual hardware bindings)
+    but which are not architecture-specific.
+"""
+import unittest
+import digitalio
+from testing.board import default_pin
+
+class TestDigitalInOut(unittest.TestCase):
+
+
+    def test_context_manager(self):
+        """Deinitialisation is triggered by __exit__() and should dispose machine.pin reference"""
+        dio = digitalio.DigitalInOut(default_pin)
+        self.assertIsNotNone(dio._pin)
+        with dio:
+            pass
+        self.assertIsNone(dio._pin)
+
+def main():
+    unittest.main()