diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 25bca10..3fb611b 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.10", "3.11", "3.12", "3.13"] + dependencies: [latest, pre] + include: + - python-version: "3.10" + dependencies: min + exclude: + # Do not test pre-releases for versions out of SPEC0 + - python-version: "3.10" + dependencies: pre + - python-version: "3.11" + 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 b65bf57..8eb0f81 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 a210583..3cd0924 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 013ec4d..a59f479 100644 --- a/tox.ini +++ b/tox.ini @@ -51,7 +51,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