Skip to content

Commit 087d867

Browse files
committed
chore: Add tox.ini, update pytest config
1 parent 3ab0a45 commit 087d867

File tree

2 files changed

+142
-2
lines changed

2 files changed

+142
-2
lines changed

pyproject.toml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,22 @@ per-file-ignores = [
150150
]
151151

152152
[tool.pytest.ini_options]
153+
minversion = "6"
154+
testpaths = ["sdcflows"]
155+
log_cli_level = "INFO"
156+
xfail_strict = true
153157
norecursedirs = [".git"]
154-
addopts = "-svx --doctest-modules --strict-markers"
158+
addopts = [
159+
"-svx",
160+
"-ra",
161+
"--strict-config",
162+
"--strict-markers",
163+
"--doctest-modules",
164+
# Config pytest-cov
165+
"--cov=sdcflows",
166+
"--cov-report=xml",
167+
"--cov-config=pyproject.toml",
168+
]
155169
doctest_optionflags = "ALLOW_UNICODE NORMALIZE_WHITESPACE ELLIPSIS"
156170
env = "PYTHONHASHSEED=0"
157171
filterwarnings = ["ignore::DeprecationWarning"]
@@ -164,7 +178,6 @@ markers = [
164178

165179
[tool.coverage.run]
166180
branch = true
167-
concurrency = 'multiprocessing'
168181
omit = [
169182
'*/tests/*',
170183
'*/__init__.py',

tox.ini

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
[tox]
2+
requires =
3+
tox>=4
4+
tox-uv
5+
envlist =
6+
py3{9,10,11,12,13}-latest
7+
py39-min
8+
py3{11,12,13}-pre
9+
style
10+
spellcheck
11+
skip_missing_interpreters = true
12+
13+
# Configuration that allows us to split tests across GitHub runners effectively
14+
[gh-actions]
15+
python =
16+
3.9: py39
17+
3.10: py310
18+
3.11: py311
19+
3.12: py312
20+
3.13: py313
21+
22+
[gh-actions:env]
23+
DEPENDS =
24+
min: min
25+
latest: latest
26+
pre: pre
27+
28+
[testenv]
29+
description = Pytest with coverage
30+
labels = test
31+
pip_pre =
32+
pre: true
33+
pass_env =
34+
TEMPLATEFLOW_HOME
35+
# Freesurfer variables searched for
36+
FREESURFER_HOME
37+
SUBJECTS_DIR
38+
FS_LICENSE
39+
# CI variables
40+
TEST_DATA_HOME
41+
TEST_OUTPUT_DIR
42+
TEST_WORK_DIR
43+
FMRIPREP_REGRESSION_SOURCE
44+
CACHED_WORK_DIRECTORY
45+
# CircleCI-specific
46+
CIRCLE_NPROCS
47+
SAVE_CIRCLE_ARTIFACTS
48+
# getpass.getuser() sources for Windows:
49+
LOGNAME
50+
USER
51+
LNAME
52+
USERNAME
53+
# Pass user color preferences through
54+
PY_COLORS
55+
FORCE_COLOR
56+
NO_COLOR
57+
CLICOLOR
58+
CLICOLOR_FORCE
59+
PYTHON_GIL
60+
deps =
61+
# Waiting on a release
62+
py313: traits @ git+https://github.com/enthought/traits.git@10954eb
63+
extras = tests
64+
setenv =
65+
pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
66+
pre: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
67+
uv_resolution =
68+
min: lowest-direct
69+
70+
commands =
71+
pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n auto}
72+
73+
[testenv:style]
74+
description = Check our style guide
75+
labels = check
76+
deps =
77+
ruff
78+
skip_install = true
79+
commands =
80+
ruff check --diff
81+
ruff format --diff
82+
83+
[testenv:style-fix]
84+
description = Auto-apply style guide to the extent possible
85+
labels = pre-release
86+
deps =
87+
ruff
88+
skip_install = true
89+
commands =
90+
ruff check --fix
91+
ruff format
92+
ruff check --select ISC001
93+
94+
[testenv:spellcheck]
95+
description = Check spelling
96+
labels = check
97+
deps =
98+
codespell[toml]
99+
skip_install = true
100+
commands =
101+
codespell . {posargs}
102+
103+
[testenv:build{,-strict}]
104+
labels =
105+
check
106+
pre-release
107+
deps =
108+
build
109+
twine
110+
skip_install = true
111+
set_env =
112+
# Ignore specific known warnings:
113+
# https://github.com/pypa/pip/issues/11684
114+
# https://github.com/pypa/pip/issues/12243
115+
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
116+
commands =
117+
python -m build
118+
python -m twine check dist/*
119+
120+
[testenv:publish]
121+
depends = build
122+
labels = release
123+
deps =
124+
twine
125+
skip_install = true
126+
commands =
127+
python -m twine upload dist/*

0 commit comments

Comments
 (0)