-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
49 lines (36 loc) · 1.22 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
"""Nox tool configuration file.
Nox is Tox tool replacement.
"""
import nox
nox.options.keywords = "not docs"
def base_install(session):
"""Creates basic environment setup for tests and linting."""
session.install("-r", "requirements.txt")
session.install("-e", ".")
return session
@nox.session(python=["3.7", "3.8"])
def tests(session):
"""Run test suite with pytest."""
session = base_install(session)
session.run("pytest", "--cov-report=html", "--cov-report=xml")
@nox.session(python="3.8")
def linting(session):
"""Launch linting locally."""
session = base_install(session)
session.run("pre-commit", "run", "-a")
@nox.session(python="3.8")
def docs(session):
"""Build the documentation."""
session.run("rm", "-rf", "docs/_build", external=True)
session.install("-r", "docs/requirements.txt")
session.install(".")
session.cd("docs")
sphinx_args = ["-b", "html", "-W", "source", "build/html"]
if not session.interactive:
sphinx_cmd = "sphinx-build"
else:
sphinx_cmd = "sphinx-autobuild"
sphinx_args.insert(0, "--open-browser")
sphinx_args.insert(0, "..")
sphinx_args.insert(0, "-z")
session.run(sphinx_cmd, *sphinx_args)