-
Notifications
You must be signed in to change notification settings - Fork 55
/
noxfile.py
62 lines (47 loc) · 1.2 KB
/
noxfile.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright (c) 2022 David Steele <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-or-later
# License-Filename: LICENSE
#
import subprocess
import nox
pkgs = [
"libcairo2-dev",
"gobject-introspection",
"libgirepository1.0-dev",
"python3-dev",
"libdbus-glib-1-dev",
"libdbus-1-dev",
]
deps = [
"pytest",
"dbus-python",
"python-networkmanager",
"flask",
"pygobject",
"cachetools",
]
def missing_pkg(pkg):
cmd = "dpkg -l {} > /dev/null".format(pkg)
return subprocess.run(cmd, shell=True).returncode != 0
@nox.session()
def test(session):
missings = [x for x in pkgs if missing_pkg(x)]
if missings:
session.error("Missing packages: %s" % format(" ".join(missings)))
for pkg in deps:
session.install(pkg)
session.run("python", "-m", "pytest")
@nox.session()
def flake8(session):
session.install("flake8")
session.run("python", "-m", "flake8", "setup.py", "cli", "comitup", "web", "test")
@nox.session()
def mypy(session):
session.install(
"mypy",
"types-tabulate",
"types-Flask",
"types-cachetools",
)
session.run("python", "-m", "mypy", "cli", "comitup", "web", "test")