File: test_pep484.py

package info (click to toggle)
python-apt 2.2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,016 kB
  • sloc: cpp: 10,180; python: 7,691; makefile: 96; sh: 18
file content (30 lines) | stat: -rw-r--r-- 750 bytes parent folder | download
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
29
30
#!/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()