-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathnoxfile.py
67 lines (51 loc) · 2.11 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
67
# type: ignore
import os
import nox
DEFAULT_PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
PYTHON_VERSIONS = os.environ.get(
"NOX_PYTHON_VERSIONS", ",".join(DEFAULT_PYTHON_VERSIONS)
).split(",")
@nox.session(python=PYTHON_VERSIONS)
def omegaconf(session):
session.install("--upgrade", "setuptools", "pip")
session.install("pytest", "pytest-mock")
session.install(".")
session.run("pytest")
@nox.session
def docs(session):
session.install("sphinx", "pytest")
session.install(".")
session.chdir("docs")
session.run("sphinx-build", "-W", "-b", "doctest", "source", "build")
session.run("sphinx-build", "-W", "-b", "html", "source", "build")
@nox.session(python=PYTHON_VERSIONS)
def coverage(session):
session.install("--upgrade", "setuptools", "pip")
session.install("coverage", "pytest", "pytest-mock")
session.run("pip", "install", "-r", "requirements/coverage.txt", silent=True)
session.run("coverage", "erase")
session.run("coverage", "run", "--append", "-m", "pytest", silent=True)
session.run("coverage", "report", "--fail-under=100")
# report to coveralls
session.run("coveralls", success_codes=[0, 1])
session.run("coverage", "erase")
@nox.session(python=PYTHON_VERSIONS)
def lint(session):
session.install("--upgrade", "setuptools", "pip")
session.run("pip", "install", "-r", "requirements/lint.txt", "-e", ".", silent=True)
session.run("mypy", ".", "--strict", silent=True)
session.run("isort", ".", "--check", silent=True)
session.run("black", "--check", ".", silent=True)
session.run("flake8")
@nox.session(python=PYTHON_VERSIONS)
def test_jupyter_notebook(session):
if session.python not in DEFAULT_PYTHON_VERSIONS:
session.skip(
"Not testing Jupyter notebook on Python {}, supports [{}]".format(
session.python, ",".join(DEFAULT_PYTHON_VERSIONS)
)
)
session.install("--upgrade", "setuptools", "pip")
session.install("jupyter", "nbval")
session.run("pip", "install", ".", silent=True)
session.run("pytest", "--nbval", "docs/notebook/Tutorial.ipynb", silent=True)