-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
75 lines (51 loc) · 1.92 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
63
64
65
66
67
68
69
70
71
72
73
74
75
"""
This module provides the configuration for our complete test suite.
We are using `nox` as our test-suite runner.
Unlike the default and common use pattern, we let `nox` run all commands via the
same Python interpreter as it is invoked by.
This makes `pyright` happy. Furthermore, we are using Nix to install all
development dependencies anyway.
A few examples for invoking `nox`:
```sh
python -m nox
python -m nox -k "not pytest"
python -m nox -k "not pyright and not mypy and not pytest"
python -m nox -s pyright mypy
python -m nox -s black isort
```
Note that we are not invoking `nox` directly. The reason is that it is installed
via Nix and its Python interpreter is different than our Python interpreter
under the Nix shell. Otherwise, none of our development dependencies would be
accessible by `nox` sessions.
"""
import nox
#: Files and directories of interest.
paths = [
"noxfile.py",
"pypara",
"tests",
]
@nox.session(python=False)
def black(session: nox.Session) -> None:
session.run("black", "--check", *paths, external=True)
@nox.session(python=False)
def isort(session: nox.Session) -> None:
session.run("isort", "--check-only", *paths, external=True)
@nox.session(python=False)
def pylint(session: nox.Session) -> None:
session.run("pylint", "pypara", "tests", external=True)
@nox.session(python=False)
def flake8(session: nox.Session) -> None:
session.run("flake8", "pypara", "tests", external=True)
@nox.session(python=False)
def pyright(session: nox.Session) -> None:
session.run("pyright", external=True)
@nox.session(python=False)
def mypy(session: nox.Session) -> None:
session.run("mypy", "pypara", "tests", external=True)
@nox.session(python=False)
def pytest(session: nox.Session) -> None:
session.run("pytest", "--verbose", "--cov", "--doctest-modules", external=True)
@nox.session(python=False)
def piplist(session: nox.Session) -> None:
session.run("pip", "list", "-o")