Standards-Version: 4.5.1
X-Python-Version: >= 3.6
Homepage: http://www.average.org/gps303
-Build-Depends: debhelper-compat (= 12),
- dh-python,
- python3-all,
- python3-setuptools,
+Build-Depends: black,
+ debhelper-compat (= 12),
+ dh-python,
+ mypy,
+ pylint,
+ python3-all,
+ python3-setuptools,
Package: python3-gps303
Architecture: all
--- /dev/null
+from glob import glob
+from subprocess import run
+from shutil import which
+from unittest import TestCase
+
+
+class BlackFormatter(TestCase):
+ def test_black(self):
+ if not which("black"):
+ self.fail(f"black not installed.")
+ cmd = (
+ ["black", "--check", "--diff", "-l", "79"]
+ + glob("gps303/**/*.py", recursive=True)
+ + glob("test/**/*.py", recursive=True)
+ )
+ output = run(cmd, capture_output=True)
+ if output.returncode == 1:
+ self.fail(
+ f"black found code that needs reformatting:\n{output.stdout.decode()}"
+ )
+ if output.returncode != 0:
+ self.fail(
+ f"black exited with code {output.returncode}:\n{output.stderr.decode()}"
+ )
--- /dev/null
+from subprocess import run
+from shutil import which
+from unittest import TestCase
+
+
+class TypeCheck(TestCase):
+ def test_mypy(self):
+ if not which("mypy"):
+ self.fail(f"mypy not installed.")
+ cmd = ["mypy", "--strict", "--ignore-missing-imports", "gps303"]
+ output = run(cmd, capture_output=True)
+ if output.returncode != 0:
+ self.fail(
+ f"mypy exited with code {output.returncode}:\n{output.stderr.decode()}"
+ )