-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
55 lines (45 loc) · 1.4 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
"""Automated testing linting and formatting apparatus."""
import nox
from nox.sessions import Session
package = "libconeangle"
nox.options.sessions = "lint", "tests", "mypy" # default session
locations = "libconeangle", "test", "noxfile.py" # Linting locations
pyversions = ["3.8", "3.9", "3.10"]
# Testing
@nox.session(python=pyversions)
def tests(session: Session) -> None:
"""Run tests."""
args = session.posargs + ["--cov=libconeangle", "--import-mode=importlib", "-s"]
session.install("pytest", "pytest-cov")
session.install(".")
session.run("pytest", *args)
# Linting
@nox.session(python="3.9")
def lint(session: Session) -> None:
"""Lint code."""
args = session.posargs or locations
session.install(
"flake8",
"flake8-black",
"flake8-bugbear",
"flake8-import-order",
"flake8-annotations",
"flake8-docstrings",
"darglint",
)
session.run("flake8", *args)
# Code formatting
@nox.session(python="3.9")
def black(session: Session) -> None:
"""Format code."""
args = session.posargs or locations
session.install("black")
session.run("black", *args)
# Static typing
@nox.session(python="3.9")
def mypy(session: Session) -> None:
"""Run the static type checker."""
args = session.posargs or locations
session.install("mypy")
session.install("types-pkg_resources")
session.run("mypy", *args)