-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathnoxfile.py
53 lines (41 loc) · 1.23 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
import nox
files = [
"lira",
"tests",
"setup.py",
"noxfile.py",
"docs/conf.py",
]
@nox.session
def tests(session):
session.install("coverage", "pytest", "pytest-asyncio")
session.install("-e", ".")
session.run("coverage", "run", "-m", "pytest", "tests", *session.posargs)
@nox.session
def coverage(session):
session.install("coverage")
session.run("coverage", "report", "--fail-under", "91")
session.run("coverage", "html")
@nox.session
def lint(session):
session.install("black", "flake8", "isort", "pydocstyle")
session.run("flake8", *files)
session.run("black", "--check", *files)
session.run("isort", "--check", *files)
session.run("pydocstyle", *files)
@nox.session
def format(session):
session.install("black", "isort")
session.run("black", *files)
session.run("isort", *files)
@nox.session
def docs(session):
session.install("-e", ".[docs]")
live_update = session.posargs and session.posargs[0] == "--live"
if live_update:
session.install("sphinx-autobuild")
session.cd("docs")
if live_update:
session.run("sphinx-autobuild", ".", "_build/html")
else:
session.run("sphinx-build", "-b", "html", "-W", ".", "_build/html")