From 9363e52d01e150a7a5c566cb3299ded83e8ca893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Mon, 21 Jul 2025 19:44:30 -0400 Subject: [PATCH 1/2] MNT: Execute slowest tests on schedule Execute slowest tests on schedule. --- .github/workflows/tox.yml | 48 +++++++++++++++++++++++++++ nitransforms/tests/test_resampling.py | 1 + nitransforms/tests/test_surface.py | 2 ++ tox.ini | 34 ++++++++++++++++++- 4 files changed, 84 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 0e9dcb48..991cded6 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -62,6 +62,7 @@ jobs: datalad get -J 2 -d $TEST_DATA_HOME test: + if: github.event_name != 'schedule' runs-on: ubuntu-latest needs: [cache-test-data] strategy: @@ -110,6 +111,53 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} if: ${{ always() }} + + slow-tests: + if: github.event_name == 'schedule': + runs-on: ubuntu-latest + needs: [cache-test-data] + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + dependencies: [latest, pre] + include: + - python-version: "3.9" + dependencies: min + exclude: + # Do not test pre-releases for versions out of SPEC0 + - python-version: "3.9" + dependencies: pre + - python-version: "3.10" + dependencies: pre + + env: + DEPENDS: ${{ matrix.dependencies }} + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v6 + - uses: actions/cache/restore@v4 + with: + path: ${{ env.TEST_DATA_HOME }} + key: data-cache-v2-${{ needs.cache-test-data.outputs.SHA }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install tox + run: | + uv tool install tox --with=tox-uv --with=tox-gh-actions + - name: Show tox config + run: tox c + - name: Run tox + run: tox -v -e slow-tests --exit-and-dump-after 1200 + checks: runs-on: 'ubuntu-latest' continue-on-error: true diff --git a/nitransforms/tests/test_resampling.py b/nitransforms/tests/test_resampling.py index b65bf579..8eb0f813 100644 --- a/nitransforms/tests/test_resampling.py +++ b/nitransforms/tests/test_resampling.py @@ -275,6 +275,7 @@ def test_displacements_field2(tmp_path, testdata_path, sw_tool): assert np.sqrt((diff**2).mean()) < RMSE_TOL_LINEAR +@pytest.mark.slow def test_apply_transformchain(tmp_path, testdata_path): """Check a translation-only field on one or more axes, different image orientations.""" os.chdir(str(tmp_path)) diff --git a/nitransforms/tests/test_surface.py b/nitransforms/tests/test_surface.py index a210583e..3cd09242 100644 --- a/nitransforms/tests/test_surface.py +++ b/nitransforms/tests/test_surface.py @@ -128,6 +128,7 @@ def test_SurfaceCoordinateTransformIO(testdata_path, tmpdir): assert sct == sct2 +@pytest.mark.slow def test_ProjectUnproject(testdata_path): sphere_reg_path = ( @@ -155,6 +156,7 @@ def test_ProjectUnproject(testdata_path): assert np.all(transformed._triangles == projunproj_ref.agg_data()[1]) +@pytest.mark.slow def test_SurfaceResampler(testdata_path, tmpdir): dif_tol = 0.001 fslr_sphere_path = ( diff --git a/tox.ini b/tox.ini index 50d167bc..6dc56f5a 100644 --- a/tox.ini +++ b/tox.ini @@ -52,7 +52,39 @@ uv_resolution = commands = python -c "import nitransforms; print(nitransforms.__version__)" - pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n auto} + pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n auto -m "not slow"} + +[testenv:slow-tests] +description = Pytest with coverage +labels = test +pip_pre = + pre: true +pass_env = + # Overrides default location for finding test data + TEST_DATA_HOME + # getpass.getuser() sources for Windows: + LOGNAME + USER + LNAME + USERNAME + # Pass user color preferences through + PY_COLORS + FORCE_COLOR + NO_COLOR + CLICOLOR + CLICOLOR_FORCE + PYTHON_GIL +extras = tests +setenv = + FSLOUTPUTTYPE=NIFTI_GZ + pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + pre: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple +uv_resolution = + min: lowest-direct + +commands = + python -c "import nitransforms; print(nitransforms.__version__)" + pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n auto -m slow} [testenv:style] description = Check our style guide From 8a2071a5daedc162aa9b9663547a75277d817cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Tue, 22 Jul 2025 19:31:16 -0400 Subject: [PATCH 2/2] MNT: Drop 3.9 from tested Python version matrix Drop 3.9 from tested Python version matrix. Co-authored-by: Oscar Esteban --- .github/workflows/tox.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index b492af85..3fb611bf 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -118,17 +118,17 @@ jobs: needs: [cache-test-data] strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13"] dependencies: [latest, pre] include: - - python-version: "3.9" + - python-version: "3.10" dependencies: min exclude: # Do not test pre-releases for versions out of SPEC0 - - python-version: "3.9" - dependencies: pre - python-version: "3.10" dependencies: pre + - python-version: "3.11" + dependencies: pre env: DEPENDS: ${{ matrix.dependencies }}