diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 97c4984e..71a1494b 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - name: Set up Python ${{ matrix.python-version }} @@ -91,8 +91,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.7 + - name: Set up Python 3 uses: actions/setup-python@v4 - with: - python-version: 3.7 - run: pipx run flake8 nitransforms diff --git a/nitransforms/io/afni.py b/nitransforms/io/afni.py index 06eaf432..7c66d434 100644 --- a/nitransforms/io/afni.py +++ b/nitransforms/io/afni.py @@ -237,7 +237,7 @@ def _is_oblique(affine, thres=OBLIQUITY_THRESHOLD_DEG): True """ - return (obliquity(affine).max() * 180 / pi) > thres + return float(obliquity(affine).max() * 180 / pi) > thres def _afni_deobliqued_grid(oblique, shape): diff --git a/nitransforms/io/base.py b/nitransforms/io/base.py index d86c8539..3c923426 100644 --- a/nitransforms/io/base.py +++ b/nitransforms/io/base.py @@ -76,12 +76,12 @@ class LinearParameters(LinearTransformStruct): Examples -------- >>> lp = LinearParameters() - >>> np.all(lp.structarr['parameters'] == np.eye(4)) + >>> np.array_equal(lp.structarr['parameters'], np.eye(4)) True >>> p = np.diag([2., 2., 2., 1.]) >>> lp = LinearParameters(p) - >>> np.all(lp.structarr['parameters'] == p) + >>> np.array_equal(lp.structarr['parameters'], p) True """ diff --git a/nitransforms/tests/test_cli.py b/nitransforms/tests/test_cli.py index 7f16a1de..58867131 100644 --- a/nitransforms/tests/test_cli.py +++ b/nitransforms/tests/test_cli.py @@ -1,10 +1,18 @@ +import os from textwrap import dedent import pytest from ..cli import cli_apply, main as ntcli +if os.getenv("PYTEST_XDIST_WORKER"): + breaks_on_xdist = pytest.mark.skip(reason="xdist is active; rerun without to run this test.") +else: + def breaks_on_xdist(test): + return test + +@breaks_on_xdist def test_cli(capsys): # empty command with pytest.raises(SystemExit): diff --git a/nitransforms/tests/test_version.py b/nitransforms/tests/test_version.py index a0723e9a..bc4c4a0a 100644 --- a/nitransforms/tests/test_version.py +++ b/nitransforms/tests/test_version.py @@ -1,10 +1,15 @@ """Test _version.py.""" import sys from collections import namedtuple -from pkg_resources import DistributionNotFound from importlib import reload +import pytest import nitransforms +try: + from pkg_resources import DistributionNotFound +except ImportError: + pytest.skip(allow_module_level=True) + def test_version_scm0(monkeypatch): """Retrieve the version via setuptools_scm.""" diff --git a/setup.cfg b/setup.cfg index 20fe531e..79e47f47 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,6 +49,7 @@ test = pytest-cov pytest-env codecov + lxml tests = %(test)s