From df9ac6e8856aef4dfb8c9d4eba3b0c63839465f1 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 29 Dec 2020 22:32:33 +0000 Subject: [PATCH 1/2] tests: update framework, add py3.9 --- .github/workflows/test.yml | 8 ++---- pyproject.toml | 2 +- setup.cfg | 59 ++++++++++++++++++++------------------ tests/__main__.py | 21 -------------- 4 files changed, 35 insertions(+), 55 deletions(-) delete mode 100644 tests/__main__.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 125feee..d2ef064 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['2.7', '3.7'] + python: [2.7, 3.6, 3.9] name: Check py${{ matrix.python }} steps: - uses: actions/checkout@v2 @@ -27,9 +27,7 @@ jobs: - uses: reviewdog/action-setup@v1 - if: github.event_name != 'schedule' run: | - set -o pipefail - pre-commit run -a flake8 | \ - reviewdog -f=pep8 -name=flake8 -tee -reporter=github-check -filter-mode nofilter + pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=github-check -filter-mode nofilter env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: startsWith(matrix.python, '3') @@ -44,7 +42,7 @@ jobs: with: fetch-depth: 0 - run: pip install -U .[dev] - - run: python -m tests --cov-report=term-missing --cov-report=xml + - run: pytest - run: codecov env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index fe0d311..9142a26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,4 +7,4 @@ write_to = "spm12/_dist_ver.py" write_to_template = "__version__ = '{version}'\n" [tool.black] -target-version = ['py27', 'py36'] +target_version = ["py27", "py36", "py38"] diff --git a/setup.cfg b/setup.cfg index 1b83fef..bf22734 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,21 +1,21 @@ [metadata] -name = spm12 -description = Statistical Parametric Mapping -long_description = file: README.rst -long_description_content_type = text/x-rst -license = Apache 2.0 -license_file = LICENCE.md -url = https://github.com/AMYPAD/SPM12 -project_urls = +name=spm12 +description=Statistical Parametric Mapping +long_description=file: README.rst +long_description_content_type=text/x-rst +license=Apache 2.0 +license_file=LICENCE.md +url=https://github.com/AMYPAD/SPM12 +project_urls= Changelog = https://github.com/AMYPAD/SPM12/releases Documentation = https://github.com/AMYPAD/SPM12/#SPM12 - Upstream Project = https://www.fil.ion.ucl.ac.uk/spm -maintainer = Casper da Costa-Luis -maintainer_email = casper.dcl@physics.org -keywords = fMRI, PET, SPECT, EEG, MEG -platforms = any -provides = spm12 -classifiers = + Upstream Project=https://www.fil.ion.ucl.ac.uk/spm +maintainer=Casper da Costa-Luis +maintainer_email=casper.dcl@physics.org +keywords=fMRI, PET, SPECT, EEG, MEG +platforms=any +provides=spm12 +classifiers= Development Status :: 4 - Beta Intended Audience :: Developers Intended Audience :: Education @@ -38,18 +38,18 @@ classifiers = Topic :: System :: Installation/Setup [options] zip_safe = False -setup_requires = setuptools>=42; setuptools_scm[toml]>=3.4 -install_requires = +setup_requires=setuptools>=42; wheel; setuptools_scm[toml]>=3.4 +install_requires= argopt miutil[nii]>=0.1.0,!=0.4.0,!=0.4.1 setuptools # pkg_resources brainweb>=1.6.2 numpy scipy -include_package_data = True -packages = find: +include_package_data=True +packages=find: [options.extras_require] -dev = +dev= pre-commit twine wheel @@ -58,23 +58,26 @@ dev = pytest-timeout pytest-xdist codecov -demo = +demo= miutil[plot]>=0.3.0 matplotlib [options.entry_points] console_scripts = - spm12 = spm12.cli:main + spm12=spm12.cli:main [options.package_data] -* = *.md, *.rst, *.m +*=*.md, *.rst, *.m [bdist_wheel] universal = 1 [flake8] -max_line_length = 88 -extend-ignore = E203,P1 -exclude = .git,__pycache__,build,dist,.eggs +max_line_length=88 +extend-ignore=E203,P1 +exclude=.git,__pycache__,build,dist,.eggs [isort] -profile = black -known_first_party = spm12,tests +profile=black +known_first_party=spm12,tests + +[tool:pytest] +addopts=-v --tb=short -rxs -W=error --log-level=debug -n=auto --durations=0 --durations-min=1 --cov=spm12 --cov-report=term-missing --cov-report=xml diff --git a/tests/__main__.py b/tests/__main__.py deleted file mode 100644 index b1a428c..0000000 --- a/tests/__main__.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys -from os import chdir, path -from subprocess import check_call - -chdir(path.dirname(path.dirname(path.abspath(__file__)))) -check_call( - [ - sys.executable, - "-m", - "pytest", - "-v", - "-n=4", - "-r=xs", - "--timeout=600", - "--timeout_method=thread", - "--log-level=debug", - "--cov=spm12", - "--durations=0", - ] - + sys.argv[1:], -) From eed272307aeb0905653260984489e3d5c90b4e04 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 29 Dec 2020 22:43:16 +0000 Subject: [PATCH 2/2] ignore matlab deprecation warnings --- tests/test_regseg.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_regseg.py b/tests/test_regseg.py index 19ba5ba..e683a60 100644 --- a/tests/test_regseg.py +++ b/tests/test_regseg.py @@ -34,6 +34,9 @@ """ % HOME, ) +no_matlab_warn = pytest.mark.filterwarnings( + "ignore:.*collections.abc:DeprecationWarning" +) def assert_equal_arrays(x, y, nmse_tol=0, denan=True): @@ -58,6 +61,7 @@ def assert_equal_arrays(x, y, nmse_tol=0, denan=True): @skip_no_data +@no_matlab_warn def test_resample(): with tmpdir() as outpath: res = regseg.resample_spm(PET, MRI, MRI2PET, outpath=outpath) @@ -68,6 +72,7 @@ def test_resample(): @skip_no_data +@no_matlab_warn def test_coreg(): with tmpdir() as outpath: res = regseg.coreg_spm(PET, MRI, outpath=outpath)