Skip to content

Commit 9363e52

Browse files
committed
MNT: Execute slowest tests on schedule
Execute slowest tests on schedule.
1 parent 0dff054 commit 9363e52

File tree

4 files changed

+84
-1
lines changed

4 files changed

+84
-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
@@ -275,6 +275,7 @@ def test_displacements_field2(tmp_path, testdata_path, sw_tool):
275275
assert np.sqrt((diff**2).mean()) < RMSE_TOL_LINEAR
276276

277277

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

nitransforms/tests/test_surface.py

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

130130

131+
@pytest.mark.slow
131132
def test_ProjectUnproject(testdata_path):
132133

133134
sphere_reg_path = (
@@ -155,6 +156,7 @@ def test_ProjectUnproject(testdata_path):
155156
assert np.all(transformed._triangles == projunproj_ref.agg_data()[1])
156157

157158

159+
@pytest.mark.slow
158160
def test_SurfaceResampler(testdata_path, tmpdir):
159161
dif_tol = 0.001
160162
fslr_sphere_path = (

tox.ini

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

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

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

0 commit comments

Comments
 (0)