1 from pkg_resources import get_distribution, DistributionNotFound
2 from subprocess import call
3 from shutil import which
4 from unittest import skipUnless, TestCase
8 mypy_version = float(get_distribution("mypy").version)
9 except DistributionNotFound:
13 class TypeCheck(TestCase):
14 @skipUnless(mypy_version >= 0.942, "Do not trust earlier mypy versions")
15 def test_mypy(self) -> None:
17 self.fail("mypy not installed.")
21 "--ignore-missing-imports",
25 self.assertEqual(call(cmd), 0, "mypy typecheck")