]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Workaround for micropython-lib unittest module main() being buggy/unhelpful with...
authorCefn Hoile <github.com@cefn.com>
Sat, 17 Feb 2018 02:02:32 +0000 (02:02 +0000)
committerCefn Hoile <github.com@cefn.com>
Sat, 17 Feb 2018 02:02:32 +0000 (02:02 +0000)
python/testing/__init__.py

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4abfca1e01a1d403f4abe62176632b671e0b3db2 100644 (file)
@@ -0,0 +1,14 @@
+import unittest
+
+def test_module(m, runner=None):
+    if runner is None:
+        runner = unittest.TestRunner()
+    suite = unittest.TestSuite()
+    for key in dir(m):
+        val = getattr(m, key)
+        try:
+            if issubclass(val, unittest.TestCase):
+                suite.addTest(val)
+        except:
+            pass
+    return runner.run(suite)
\ No newline at end of file