File: noxfile.py

package info (click to toggle)
comitup 1.43-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,252 kB
  • sloc: python: 3,093; javascript: 1,261; sh: 95; makefile: 34
file content (62 lines) | stat: -rw-r--r-- 1,229 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
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 <dsteele@gmail.com>
#
# 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")