forked from napari/napari
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
154 lines (139 loc) · 4.78 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
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
# NOTE: if you use conda for environments and an error like this:
# "ERROR: InterpreterNotFound: python3.8"
# then run `pip install tox-conda` to use conda to build environments
[tox]
# this is the list of tox "environments" that will run *by default*
# when you just run "tox" alone on the command line
# non-platform appropriate tests will be skipped
# to run a specific test, use the "tox -e" option, for instance:
# "tox -e py38-macos-pyqt" will test python3.8 with pyqt on macos
# (even if a combination of factors is not in the default envlist
# you can run it manually... like py39-linux-pyside2-async)
envlist = py{38,39,310,311}-{linux,macos,windows}-{pyqt5,pyside2,pyqt6,pyside6},mypy
isolated_build = true
toxworkdir=/tmp/.tox
[gh-actions]
python =
3.8: py38
3.9: py39
3.9.0: py390
3.10: py310
3.11: py311
fail_on_no_env = True
# This section turns environment variables from github actions
# into tox environment factors. This, combined with the [gh-actions]
# section above would mean that a test running python 3.9 on ubuntu-latest
# with an environment variable of BACKEND=pyqt would be converted to a
# tox env of `py39-linux-pyqt5`
[gh-actions:env]
RUNNER_OS =
Linux: linux
Windows: windows
macOS: macos
BACKEND =
pyqt5: pyqt5
pyqt6: pyqt6
pyside2: pyside2
pyside6: pyside6
headless: headless
# Settings defined in the top-level testenv section are automatically
# inherited by individual environments unless overridden.
[testenv]
platform =
macos: darwin
linux: linux
windows: win32
# These environment variables will be passed from the calling environment
# to the tox environment
passenv =
CI
GITHUB_ACTIONS
DISPLAY
XAUTHORITY
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
PYVISTA_OFF_SCREEN
MIN_REQ
CONDA_EXE
CONDA
FORCE_COLOR
# Set various environment variables, depending on the factors in
# the tox environment being run
setenv =
PYTHONPATH = {toxinidir}
async: NAPARI_ASYNC = 1
async: PYTEST_ADDOPTS = --async_only
async: PYTEST_PATH = napari
# Avoid pyside6 6.4.3 due to issue described in:
# https://github.com/napari/napari/issues/5657
deps =
pytest-cov
pyqt6: PyQt6
pyside6: PySide6 < 6.3.2 ; python_version < '3.10'
pyside6: PySide6 != 6.4.3, !=6.5.0 ; python_version >= '3.10'
pytest-json-report
# use extras specified in setup.cfg for certain test envs
extras =
testing
pyqt5: pyqt5
pyside2: pyside2
indexserver =
# we use Spec 4 index server that contain nightly wheel.
# this will be used only when using --pre with tox/pip as it only contains nightly.
extra = https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
commands_pre =
# strictly only need to uninstall pytest-qt (which will raise without a backend)
# the rest is for good measure
headless: pip uninstall -y pytest-qt qtpy pyqt5 pyside2 pyside6 pyqt6
commands =
!headless: python -m pytest {env:PYTEST_PATH:} --color=yes --basetemp={envtmpdir} \
--cov-report=xml --cov={env:PYTEST_PATH:napari} --ignore tools --maxfail=5 \
--json-report --json-report-file={toxinidir}/report-{envname}.json \
{posargs}
# do not add ignores to this line just to make headless tests pass.
# nothing outside of _qt or _vispy should require Qt or make_napari_viewer
headless: python -m pytest --color=yes --basetemp={envtmpdir} --ignore napari/_vispy \
--ignore napari/_qt --ignore napari/_tests --ignore tools \
--json-report --json-report-file={toxinidir}/report-{envname}.json {posargs}
[testenv:py{38,39,310,311}-{linux,macos,windows}-{pyqt5,pyside2}-examples]
deps =
# For surface_timeseries_.py example
nilearn
# Due to nilearn incompatibility with numpy >=1.24 constraint numpy and add packaging for version check
numpy < 1.24
packaging
commands =
python -m pytest napari/_tests/test_examples.py -v --color=yes --basetemp={envtmpdir} {posargs}
[testenv:ruff]
skip_install = True
deps = pre-commit
commands = pre-commit run ruff --all-files
[testenv:black]
skip_install = True
deps = pre-commit
commands = pre-commit run black --all-files
[testenv:import-lint]
skip_install = True
deps = pre-commit
commands = pre-commit run --hook-stage manual import-linter --all-files
[testenv:package]
isolated_build = true
skip_install = true
deps =
check_manifest
wheel
twine
build
commands =
check-manifest
python -m build
python -m twine check dist/*
[testenv:mypy]
deps =
-r resources/requirements_mypy.txt
commands =
mypy --config-file pyproject.toml
skip_install = true