]> www.average.org Git - loctrkd.git/blobdiff - test/test_mypy.py
test: make unittests individually runnable
[loctrkd.git] / test / test_mypy.py
index 08f2c5eefdc7b3ed1720d0ac70dfaa563936a99b..d93f5685a0b752065b47dcfc8442144f277487c3 100644 (file)
@@ -1,9 +1,17 @@
+from pkg_resources import get_distribution, DistributionNotFound
 from subprocess import call
 from shutil import which
-from unittest import TestCase
+from unittest import main, skipUnless, TestCase
+
+mypy_version = 0.0
+try:
+    mypy_version = float(get_distribution("mypy").version)
+except DistributionNotFound:
+    pass
 
 
 class TypeCheck(TestCase):
+    @skipUnless(mypy_version >= 0.942, "Do not trust earlier mypy versions")
     def test_mypy(self) -> None:
         if not which("mypy"):
             self.fail("mypy not installed.")
@@ -15,3 +23,7 @@ class TypeCheck(TestCase):
             "test",
         ]
         self.assertEqual(call(cmd), 0, "mypy typecheck")
+
+
+if __name__ == "__main__":
+    main()