Skip to content

Commit 71a9bd9

Browse files
jhlegarretaeffigies
andcommitted
MNT: Execute slowest tests on schedule
Execute slowest tests on schedule. Co-authored-by: Chris Markiewicz <[email protected]>
1 parent 0c2ad9f commit 71a9bd9

File tree

5 files changed

+87
-1
lines changed

5 files changed

+87
-1
lines changed

.github/workflows/tox.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
datalad get -J 2 -d $TEST_DATA_HOME
6363
6464
test:
65+
if: github.event_name != 'schedule'
6566
runs-on: ubuntu-latest
6667
needs: [cache-test-data]
6768
strategy:
@@ -110,6 +111,53 @@ jobs:
110111
token: ${{ secrets.CODECOV_TOKEN }}
111112
if: ${{ always() }}
112113

114+
115+
slow-tests:
116+
if: github.event_name == 'schedule'
117+
runs-on: ubuntu-latest
118+
needs: [cache-test-data]
119+
strategy:
120+
matrix:
121+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
122+
dependencies: [latest, pre]
123+
include:
124+
- python-version: "3.9"
125+
dependencies: min
126+
exclude:
127+
# Do not test pre-releases for versions out of SPEC0
128+
- python-version: "3.9"
129+
dependencies: pre
130+
- python-version: "3.10"
131+
dependencies: pre
132+
133+
env:
134+
DEPENDS: ${{ matrix.dependencies }}
135+
136+
steps:
137+
- uses: actions/checkout@v4
138+
with:
139+
submodules: recursive
140+
fetch-depth: 0
141+
- name: Install the latest version of uv
142+
uses: astral-sh/setup-uv@v6
143+
- uses: actions/cache/restore@v4
144+
with:
145+
path: ${{ env.TEST_DATA_HOME }}
146+
key: data-cache-v2-${{ needs.cache-test-data.outputs.SHA }}
147+
- name: Set up Python ${{ matrix.python-version }}
148+
uses: actions/setup-python@v5
149+
with:
150+
python-version: ${{ matrix.python-version }}
151+
- name: Display Python version
152+
run: python -c "import sys; print(sys.version)"
153+
- name: Install tox
154+
run: |
155+
uv tool install tox --with=tox-uv --with=tox-gh-actions
156+
- name: Show tox config
157+
run: tox c
158+
- name: Run tox
159+
run: tox -v -e slow-tests --exit-and-dump-after 1200
160+
113161
checks:
114162
runs-on: 'ubuntu-latest'
115163
continue-on-error: true

nitransforms/tests/test_resampling.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ def test_displacements_field2(tmp_path, testdata_path, sw_tool):
286286
assert np.sqrt((diff**2).mean()) < RMSE_TOL_LINEAR
287287

288288

289+
@pytest.mark.slow
289290
def test_apply_transformchain(tmp_path, testdata_path):
290291
"""Check a translation-only field on one or more axes, different image orientations."""
291292
os.chdir(str(tmp_path))

nitransforms/tests/test_surface.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def test_SurfaceCoordinateTransformIO(testdata_path, tmpdir):
138138
assert sct == sct2
139139

140140

141+
@pytest.mark.slow
141142
def test_ProjectUnproject(testdata_path):
142143
sphere_reg_path = (
143144
testdata_path
@@ -165,6 +166,7 @@ def test_ProjectUnproject(testdata_path):
165166
assert np.all(transformed._triangles == projunproj_ref.agg_data()[1])
166167

167168

169+
@pytest.mark.slow
168170
def test_SurfaceResampler(testdata_path, tmpdir):
169171
dif_tol = 0.001
170172
fslr_sphere_path = testdata_path / "tpl-fsLR_hemi-R_den-32k_sphere.surf.gii"

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ doctest_optionflags = "ALLOW_UNICODE NORMALIZE_WHITESPACE ELLIPSIS"
8383
env = "PYTHONHASHSEED=0"
8484
filterwarnings = ["ignore::DeprecationWarning"]
8585
junit_family = "xunit2"
86+
markers = [
87+
"slow: marks tests as slow (deselect with '-m \"not slow\"')"
88+
]
8689

8790
[tool.coverage.run]
8891
branch = true

tox.ini

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,39 @@ uv_resolution =
5151

5252
commands =
5353
python -c "import nitransforms; print(nitransforms.__version__)"
54-
pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n auto}
54+
pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n auto -m "not slow"}
55+
56+
[testenv:slow-tests]
57+
description = Pytest with coverage
58+
labels = test
59+
pip_pre =
60+
pre: true
61+
pass_env =
62+
# Overrides default location for finding test data
63+
TEST_DATA_HOME
64+
# getpass.getuser() sources for Windows:
65+
LOGNAME
66+
USER
67+
LNAME
68+
USERNAME
69+
# Pass user color preferences through
70+
PY_COLORS
71+
FORCE_COLOR
72+
NO_COLOR
73+
CLICOLOR
74+
CLICOLOR_FORCE
75+
PYTHON_GIL
76+
extras = tests
77+
setenv =
78+
FSLOUTPUTTYPE=NIFTI_GZ
79+
pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
80+
pre: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
81+
uv_resolution =
82+
min: lowest-direct
83+
84+
commands =
85+
python -c "import nitransforms; print(nitransforms.__version__)"
86+
pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n auto -m slow}
5587

5688
[testenv:style]
5789
description = Check our style guide

0 commit comments

Comments
 (0)