Skip to content

Commit a4d015b

Browse files
committed
chore(tox): Configure tox
1 parent 85db111 commit a4d015b

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ test = [
3838
"pytest >= 6",
3939
"pytest-cov",
4040
"pytest-env",
41+
"pytest-xdist",
4142
"codecov",
4243
"nitransforms[niftiext]",
4344
]

tox.ini

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
[tox]
2+
requires =
3+
tox>=4
4+
envlist =
5+
py3{9,10,11,12}-latest
6+
py39-min
7+
py3{10,11,12}-pre
8+
skip_missing_interpreters = true
9+
10+
# Configuration that allows us to split tests across GitHub runners effectively
11+
[gh-actions]
12+
python =
13+
3.9: py39
14+
3.10: py310
15+
3.11: py311
16+
3.12: py312
17+
18+
[gh-actions:env]
19+
DEPENDS =
20+
min: min
21+
latest: latest
22+
pre: pre
23+
24+
[testenv]
25+
description = Pytest with coverage
26+
labels = test
27+
pip_pre =
28+
pre: true
29+
pass_env =
30+
# getpass.getuser() sources for Windows:
31+
LOGNAME
32+
USER
33+
LNAME
34+
USERNAME
35+
# Pass user color preferences through
36+
PY_COLORS
37+
FORCE_COLOR
38+
NO_COLOR
39+
CLICOLOR
40+
CLICOLOR_FORCE
41+
PYTHON_GIL
42+
extras = tests
43+
setenv =
44+
pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
45+
pre: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
46+
uv_resolution =
47+
min: lowest-direct
48+
49+
commands =
50+
python -c "import nitransforms; print(nitransforms.__version__)"
51+
pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n 0}
52+
53+
[testenv:style]
54+
description = Check our style guide
55+
labels = check
56+
deps =
57+
ruff
58+
skip_install = true
59+
commands =
60+
ruff check --diff
61+
ruff format --diff
62+
63+
[testenv:style-fix]
64+
description = Auto-apply style guide to the extent possible
65+
labels = pre-release
66+
deps =
67+
ruff
68+
skip_install = true
69+
commands =
70+
ruff check --fix
71+
ruff format
72+
ruff check --select ISC001
73+
74+
[testenv:spellcheck]
75+
description = Check spelling
76+
labels = check
77+
deps =
78+
codespell[toml]
79+
skip_install = true
80+
commands =
81+
codespell . {posargs}
82+
83+
[testenv:build{,-strict}]
84+
labels =
85+
check
86+
pre-release
87+
deps =
88+
build
89+
twine
90+
skip_install = true
91+
set_env =
92+
# Ignore specific known warnings:
93+
# https://github.com/pypa/pip/issues/11684
94+
# https://github.com/pypa/pip/issues/12243
95+
strict: PYTHONWARNINGS=error,once:pkg_resources is deprecated as an API.:DeprecationWarning:pip._internal.metadata.importlib._envs,once:Unimplemented abstract methods {'locate_file'}:DeprecationWarning:pip._internal.metadata.importlib._dists
96+
commands =
97+
python -m build
98+
python -m twine check dist/*
99+
100+
[testenv:publish]
101+
depends = build
102+
labels = release
103+
deps =
104+
twine
105+
skip_install = true
106+
commands =
107+
python -m twine upload dist/*

0 commit comments

Comments
 (0)