forked from ploomber/sklearn-evaluation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
50 lines (42 loc) · 1.52 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
import os
import platform
import nox
# NOTE: adding
# venv_params=["--channel", "conda-forge"]
# is breaking the installation
@nox.session(
venv_backend="conda",
python=os.environ.get("PYTHON_VERSION", "3.8"),
)
def tests(session):
session.install("pip", "--upgrade")
# if we remove the --editable flag pytest throws an error, because there
# are two copies of the pkg (src/ and site-packages/), this is a quick
# way to fix it
# https://github.com/pytest-dev/pytest/issues/7678
session.install("--editable", ".")
# test vanilla installation is importable
session.run("python", "-c", "import sklearn_evaluation")
# this is needed to run tests
session.conda_install("lxml")
# install other test dependencies
session.install("--editable", ".[all]")
# run unit tests
# docstrings
# pytest doctest docs: https://docs.pytest.org/en/latest/doctest.html
# doctest docs: https://docs.python.org/3/library/doctest.html
# and examples (this is a hacky way to do it since --doctest-modules will
# first load any .py files, which are the examples, and then try to run
# any doctests, there isn't any)
session.run(
"pytest",
"tests/",
"src/",
"examples/",
"--cov=sklearn_evaluation",
"--doctest-modules",
)
session.run("coveralls")
if session.python == "3.8" and platform.system() == "Linux":
# build docs so we can detect build errors
session.run("jupyter-book", "build", "docs/", external=True)