| 1 |
"""Test process to run in isolated environments.""" |
| 2 |
|
| 3 |
import nox |
| 4 |
|
| 5 |
|
| 6 |
@nox.session(reuse_venv=True) |
| 7 |
def test(session): |
| 8 |
"""Apply the tests on the lib.""" |
| 9 |
session.install(".[test]") |
| 10 |
test_files = session.posargs or ["tests"] |
| 11 |
session.run("pytest", "--color=yes", "--cov", "--cov-report=html", *test_files) |
| 12 |
|
| 13 |
|
| 14 |
@nox.session(name="mypy", reuse_venv=True) |
| 15 |
def mypy(session): |
| 16 |
"""Run the mypy evaluation of the lib.""" |
| 17 |
session.install(".") |
| 18 |
session.install("mypy") |
| 19 |
test_files = session.posargs or ["sphinx_favicon"] |
| 20 |
session.run( |
| 21 |
"mypy", |
| 22 |
"--ignore-missing-imports", |
| 23 |
"--install-types", |
| 24 |
"--non-interactive", |
| 25 |
*test_files, |
| 26 |
) |
| 27 |
|
| 28 |
|
| 29 |
@nox.session(name="docs", reuse_venv=True) |
| 30 |
def docs(session): |
| 31 |
"""Build the docs.""" |
| 32 |
session.install(".[doc]") |
| 33 |
session.run( |
| 34 |
"sphinx-build", "-b=html", *session.posargs, "docs/source", "docs/build/html" |
| 35 |
) |
| 36 |
|
| 37 |
|
| 38 |
@nox.session(reuse_venv=True) |
| 39 |
def lint(session): |
| 40 |
"""Run pre-commit linting checks.""" |
| 41 |
session.install(".[test]") |
| 42 |
session.run("pre-commit", "run", "--all-files", external=True) |