-
Notifications
You must be signed in to change notification settings - Fork 8
/
noxfile.py
53 lines (44 loc) · 1.1 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
nox.options.sessions = ["tests"]
python_versions = ("3.10", "3.11", "3.12")
@nox.session
def tests(session):
"""
Run tests with pytest.
"""
pytest_options = {}
session.install(".[tests]")
session.run("pytest", *pytest_options)
@nox.session
def linters(session):
"""
Run all pre-commit hooks on all files.
"""
session.install("pre-commit")
session.run("pre-commit", "run", "--all-files", *session.posargs)
@nox.session
def import_package(session):
"""
Import xrtpy.
"""
session.install(".")
session.run("python", "-c", "import xrtpy")
@nox.session
def docs(session):
"""
Build documentation with Sphinx.
"""
sphinx_paths = ["docs", "docs/_build/html"]
sphinx_fail_on_warnings = ["-W", "--keep-going"]
sphinx_builder = ["-b", "html"]
sphinx_nitpicky = ["-n"]
sphinx_opts = (
sphinx_paths + sphinx_fail_on_warnings + sphinx_builder + sphinx_nitpicky
)
session.install(".[docs]")
session.run(
"sphinx-build",
*sphinx_opts,
*sphinx_nitpicky,
*session.posargs,
)