From: Cefn Hoile Date: Sun, 18 Feb 2018 01:27:18 +0000 (+0000) Subject: Separated mcp-specific subparts of DigitalInOut testcase X-Git-Tag: 0.1.0~4^2~135 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/078154a5b9f50b1e429a55f0382aea27acc1a459?ds=inline Separated mcp-specific subparts of DigitalInOut testcase --- diff --git a/python/testing/platform/mcp/digitalio.py b/python/testing/platform/mcp/digitalio.py new file mode 100644 index 0000000..adbabe0 --- /dev/null +++ b/python/testing/platform/mcp/digitalio.py @@ -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()