+from pkg_resources import get_distribution, DistributionNotFound
from subprocess import call
from shutil import which
-from unittest import TestCase
+from unittest import 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.")