-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnoxfile.py
104 lines (80 loc) · 2.44 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import shutil
from pprint import pprint
import nox
@nox.session(python=["3.6"])
def tests(session):
session.install("-e", ".")
session.install("pytest")
session.run("pytest")
@nox.session(python=["3.8", "3.7", "3.6"])
def coverage(session):
session.install("coverage>=5.0.0")
session.install("-e", ".")
session.install("pytest", "pytest-cov")
session.run(
"pytest",
"--cov=src",
"--cov-append",
"--cov-config",
".coveragerc",
"--cov-report",
"term-missing:skip-covered",
)
session.notify("coverage_report")
@nox.session
def coverage_report(session):
session.install("coverage>=5.0.0")
session.run("coverage", "html")
session.notify("coverage_erase")
session.run("coverage", "report", "--show-missing")
# TODO: "--fail-under=100"
@nox.session
def coverage_erase(session):
session.install("coverage")
session.run("coverage", "erase")
FILES = [
"src",
"tests",
"noxfile.py",
"noxfile-lint.py",
"setup.py",
"docssrc/source/conf.py",
]
@nox.session
def hint(session):
session.install("isort", "black")
# session.run('yapf', '--in-place', '--recursive', *FILES)
session.run("black", *FILES)
session.run("isort", "--recursive", *FILES)
@nox.session
def lint(session):
session.install("nox", "vox", "check-manifest")
# session.run("check-manifest")
# Delete NOXSESSION so vox can run on CI.
session.env.pop("NOXSESSION", None)
session.run("nox", "-r", "-f", "noxfile-lint.py", "--", *session.posargs)
def docs_command(builder):
return [
"sphinx-build",
"-b",
builder,
"docssrc/source",
"docssrc/build/_build/{}".format(builder),
]
@nox.session
def docs(session):
session.notify("docs_test")
session.notify("docs_build")
@nox.session(python="3.8")
def docs_test(session):
session.install(".", "sphinx", "sphinx_rtd_theme", "sphinx-autodoc-typehints")
shutil.rmtree("docssrc/build/", ignore_errors=True)
session.run(*docs_command("doctest"))
session.run(*docs_command("linkcheck"))
session.run(*docs_command("html"))
shutil.rmtree("docssrc/build/", ignore_errors=True)
@nox.session(python="3.8")
def docs_build(session):
session.install(".", "sphinx", "sphinx_rtd_theme", "sphinx-autodoc-typehints")
shutil.rmtree("docs/", ignore_errors=True)
session.run("sphinx-build", "-b", "html", "docssrc/source", "docs", "-a")