-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathnoxfile.py
66 lines (57 loc) · 1.54 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
import nox
# nox options
nox.options.reuse_existing_virtualenvs = True
@nox.session
def unit(session):
session.run_always("pip", "install", "-e", ".[all]")
session.install("pytest", "pytest-mock")
session.run("pytest", "--unit")
@nox.session
def coverage(session):
session.run_always("pip", "install", "-e", ".[all]")
session.install("pytest", "pytest-cov", "pytest-mock")
session.run(
"pytest",
"--unit",
"--examples",
"--cov",
"--cov-report=xml",
)
@nox.session
def notebooks(session):
"""Run the examples tests for Jupyter notebooks."""
session.run_always("pip", "install", "-e", ".[all]")
session.install("pytest", "nbmake")
session.run("pytest", "--nbmake", "--examples", "examples/", external=True)
@nox.session
def docs(session):
"""
Build the documentation and load it in a browser tab, rebuilding on changes.
Credit: PyBaMM Team
"""
envbindir = session.bin
session.install("-e", ".[all,docs]")
session.chdir("docs")
# Local development
if session.interactive:
session.run(
"sphinx-autobuild",
"-j",
"auto",
"--open-browser",
"-qT",
".",
f"{envbindir}/../tmp/html",
)
# Runs in CI only, treating warnings as errors
else:
session.run(
"sphinx-build",
"-j",
"auto",
"-b",
"html",
"--keep-going",
".",
"_build/html",
)