forked from internetofwater/nldi-crawler
-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
73 lines (59 loc) · 2.06 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
#!/usr/bin/env python
# coding: utf-8
"""
NOX (The Pythonic make) config to automate test, lint, black, etc.
"""
import nox # pylint: disable=E0401
# Global options (a.k.a. make defaults)
nox.options.sessions = "lint", "unittest"
src_locations = "src", "tests", "noxfile.py"
@nox.session(python="3.10")
def reformat(session):
"""Use the Black formatter to pretty-fy souce code."""
args = session.posargs or src_locations
session.install("black")
session.run("black", *args)
@nox.session(python=["3.10"])
def typecheck(session):
"""Static type checking using pytype (a little easier than mypy)"""
args = session.posargs or ["--disable=import-error", *src_locations]
session.install("pytype")
session.run("pytype", *args)
@nox.session(python=["3.10"])
def lint(session):
"""Linter -- prefer pylint over flake8..."""
args = session.posargs or src_locations
session.run("poetry", "install", external=True)
session.install("black")
session.run("black", *args)
session.install("pylint")
session.run("pylint", *args)
@nox.session(python=["3.10"])
def test(session):
"""test suite, including coverage report"""
args = session.posargs or src_locations
session.run("poetry", "install", external=True)
session.run("black", *args)
session.run("pytest", "-v", "--cov", "--sparse-ordering", external=True)
@nox.session(python=["3.10"])
def unittest(session):
"""unit-tests only. Will not execute anything marked as integration."""
session.run("poetry", "install", external=True)
session.run(
"pytest",
"--ff",
"-v",
"--cov",
"-m",
"not integration",
"--sparse-ordering",
external=True,
)
@nox.session(python=["3.10"])
def docs(session):
"""Rudimentary doc build system using sphinx. TODO: enhance with mkdocs."""
session.run("poetry", "install", external=True)
session.install(
"sphinx", "sphinx-autodoc-typehints", "sphinx-rtd-theme", "sphinxcontrib-mermaid"
)
session.run("sphinx-build", "docs", "docs/_build")