From 84a6956f6dd23c93a613aeb3d02f6de5461ccdc4 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 10 Mar 2026 15:52:44 -0400 Subject: [PATCH 1/3] chore(ci): Add `python -m pytest` test --- .github/workflows/test.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 774c509e0..b3a86a5ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -105,7 +105,7 @@ jobs: - name: Run tests run: pytest --doctest-modules --doctest-plus -v --pyargs nibabel -n auto - test: + tox: # Check each OS, all supported Python, minimum versions and latest releases runs-on: ${{ matrix.os }} strategy: @@ -227,6 +227,26 @@ jobs: path: test-results.xml if: ${{ always() }} + pytest: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.14'] + steps: + - name: Shallow checkout + uses: actions/checkout@v6 + - name: Setup uv and Python ${{ matrix.python-version }} + uses: astral-sh/setup-uv@v7 + with: + python-version: ${{ matrix.python-version }} + activate-environment: true + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install with pytest + run: uv sync --extra=test --extra=all + - name: Run test suite + run: python -m pytest + checks: runs-on: 'ubuntu-slim' continue-on-error: true @@ -255,7 +275,7 @@ jobs: publish: runs-on: ubuntu-slim environment: "Package deployment" - needs: [test, test-package] + needs: [tox, pytest, test-package] permissions: # Required for trusted publishing id-token: write From 719b5f9ec2ae4b8b67be91df80f64428a614009e Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 10 Mar 2026 15:54:23 -0400 Subject: [PATCH 2/3] fix: Ignore executable name in checking for usage output --- nibabel/cmdline/tests/test_roi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nibabel/cmdline/tests/test_roi.py b/nibabel/cmdline/tests/test_roi.py index bc8d11d62..0b8caa96a 100644 --- a/nibabel/cmdline/tests/test_roi.py +++ b/nibabel/cmdline/tests/test_roi.py @@ -147,7 +147,7 @@ def test_entrypoint(capsys): with pytest.raises(SystemExit): main() captured = capsys.readouterr() - assert captured.out.startswith('usage: nib-roi') + assert captured.out.startswith('usage: ') def test_nib_roi_unknown_axes(capsys): From d8653ec9ec1c6dc5c9241ae016b586815add96ac Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 10 Mar 2026 16:04:33 -0400 Subject: [PATCH 3/3] test: Skip removalschedule tests on shallow checkouts --- nibabel/tests/test_removalschedule.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nibabel/tests/test_removalschedule.py b/nibabel/tests/test_removalschedule.py index d2bc7da2f..f08d3b65b 100644 --- a/nibabel/tests/test_removalschedule.py +++ b/nibabel/tests/test_removalschedule.py @@ -173,3 +173,7 @@ def test_unremoved_object(): def test_unremoved_attr(): with pytest.raises(AssertionError): test_attribute_removal() + + +if cmp_pkg_version('1.0.0') > -1: + pytest.skip('Shallow checkout, version unavailable', allow_module_level=True)