summaryrefslogtreecommitdiffstats
path: root/tests/test_pep484.py
blob: 01711dcea7ba2f5c895671aee4513d29ff1140ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python3

import os
import subprocess
import unittest


def hasMyPy():
    try:
        subprocess.check_call(["mypy", "--version"])
    except Exception:
        return False
    return True


class PackagePep484TestCase(unittest.TestCase):
    @unittest.skipIf(not hasMyPy(), "no mypy available")
    def test_pep484_clean(self):
        # FIXME: check all of it
        top_src_dir = os.path.join(os.path.dirname(__file__), "..", "apt")
        os.environ["MYPYPATH"] = os.path.join(
            os.path.dirname(__file__), "..", "typehinting"
        )
        self.assertEqual(subprocess.call(["mypy", "--strict", top_src_dir]), 0)


if __name__ == "__main__":
    unittest.main()