-
Notifications
You must be signed in to change notification settings - Fork 3
/
tox.ini
155 lines (142 loc) · 4.27 KB
/
tox.ini
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
[tox]
lint_folders =
"{toxinidir}/src" \
"{toxinidir}/tests" \
"{toxinidir}/docs/src/"
notebooks =
{toxinidir}/docs/src/check.ipynb \
{toxinidir}/docs/src/exercises.ipynb \
{toxinidir}/docs/src/getting_started.ipynb \
{toxinidir}/docs/src/nbgrader.ipynb
envlist =
lint
tests-lab-3
tests-notebook-7
[testenv]
[testenv:tests-lab-3]
description =
Tests with jupyter lab version < 4
setenv =
# this is needed to run selenium on a machine without display to do CI
SELENIUM_FIREFOX_DRIVER_ARGS = {env:SELENIUM_FIREFOX_DRIVER_ARGS:--headless}
JUPYTER_TYPE = lab
# use the jupyter config in the tox environment
# otherwise the users config is used
JUPYTER_CONFIG_DIR={envdir}/etc/jupyter
JUPYTER_DATA_DIR={envdir}/share/jupyter
deps =
pytest<8.0.0
pytest-rerunfailures
pytest-html<4.0.0,
# selenium juypter notebook tests
jupyterlab==3.6.5
# fixing selenium version to have backwards-compatibility with pytest-selenium
# see https://github.com/robotframework/SeleniumLibrary/issues/1835#issuecomment-1581426365
selenium==4.9.0
pytest-selenium
jupytext==1.15.0
imageio
# we fix matplotlib for consistent image tests
matplotlib==3.7.2
numpy<2.0.0
scikit-image
ipympl
commands =
# converts the python files to ipython notebooks
jupytext tests/notebooks/*.py --to ipynb
pytest {posargs:-v --reruns 4} --driver Firefox
[testenv:tests-lab-4]
description =
Tests with jupyter lab version >= 4
setenv =
# this is needed to run selenium on a machine without display to do CI
SELENIUM_FIREFOX_DRIVER_ARGS = {env:SELENIUM_FIREFOX_DRIVER_ARGS:--headless}
JUPYTER_TYPE = lab
# use the jupyter config in the tox environment
# otherwise the users config is used
JUPYTER_CONFIG_DIR={envdir}/etc/jupyter
JUPYTER_DATA_DIR={envdir}/share/jupyter
deps =
pytest<8.0.0
pytest-rerunfailures
pytest-html<4.0.0,
# selenium juypter notebook tests
jupyterlab>=4.0.0
# fixing selenium version to have backwards-compatibility with pytest-selenium
# see https://github.com/robotframework/SeleniumLibrary/issues/1835#issuecomment-1581426365
selenium==4.9.0
pytest-selenium
jupytext==1.15.0
imageio
# we fix matplotlib for consistent image tests
matplotlib==3.7.2
numpy<2.0.0
scikit-image
ipympl
commands =
# converts the python files to ipython notebooks
jupytext tests/notebooks/*.py --to ipynb
pytest {posargs:-v --reruns 4} -m "not matplotlib" --driver Firefox
[testenv:coverage]
# We do coverage in a separate environment that skips the selenium tests but
# includes the jupytext notebook files, because coverage is incompatible with
# selenium
deps =
pytest<8.0.0
pytest-cov
coverage[toml]
selenium==4.9.0
ipympl
commands =
pytest --cov=scwidgets --ignore=tests/test_widgets.py -o testpaths="tests tests/notebooks/*py"
commands_post =
coverage xml
coverage html
[coverage:report]
exclude_also =
def _on
[testenv:docs]
deps =
-r docs/requirements.txt
commands =
ipython kernel install --sys-prefix --name "python"
sphinx-build {posargs:-E} -b html docs/src docs/build/html
[testenv:format]
# formats project source code files
skip_install = true
deps =
black
blackdoc
isort
nbstripout
commands =
nbstripout {[tox]notebooks}
black {[tox]lint_folders}
blackdoc {[tox]lint_folders}
isort {[tox]lint_folders}
nbstripout {[tox]|docs_folder}docs/src/*ipynb
[testenv:lint]
# this environement lints the Python code with flake8 (code linter),
# black (code formatter), isort (sorting of imports) mypy (static type checks)
setenv =
# mypy searches this directory to find the package
# see https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules
MYPYPATH={env:MYPATH:src}
package = skip
deps =
flake8
flake8-bugbear
black
blackdoc
isort
mypy
nbstripout
commands =
nbstripout --verify {[tox]notebooks}
flake8 {[tox]lint_folders}
black --check --diff {[tox]lint_folders}
blackdoc --check --diff {[tox]lint_folders}
isort --check-only --diff {[tox]lint_folders}
mypy --ignore-missing-imports --explicit-package-bases --package scwidgets
[flake8]
max_line_length = 88