File: test_pep484.py

package info (click to toggle)
python-apt 2.6.0
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,044 kB
  • sloc: cpp: 10,192; python: 8,547; makefile: 94; sh: 18
file content (28 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (2)
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()