1
0

Accepting request 819962 from home:mcalabkova:branches:devel:languages:python:numeric

- Update to 3.1.1
  * Conformation function (``processing.conform``) and CLI tool
    (``nib-conform``) to apply shape, orientation and zooms (pr/853) (Jakub
    Kaczmarzyk, reviewed by CM, YOH)
  * Affine rescaling function (``affines.rescale_affine``) to update
    dimensions and voxel sizes (pr/853) (CM, reviewed by Jakub Kaczmarzyk)
  * ``kw_only_meth``/``kw_only_func`` decorators are deprecated (pr/848)
    (RM, reviewed by CM)
- Add patch purge-nose.patch

OBS-URL: https://build.opensuse.org/request/show/819962
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-nibabel?expand=0&rev=11
This commit is contained in:
Tomáš Chvátal 2020-07-10 10:49:44 +00:00 committed by Git OBS Bridge
parent 71206d856a
commit 82fbeb248f
5 changed files with 211 additions and 7 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d38c657eca6ae3d246db9019549be5448b7a0a6683240c96bff2cebf91b7d422
size 4615979

3
nibabel-3.1.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b5efff77c81affbed2a85a038fb7948669b088b4a87ff6fdf358f83acf4b39ce
size 4617212

189
purge-nose.patch Normal file
View File

@ -0,0 +1,189 @@
Index: nibabel-3.1.1/nisext/tests/test_sexts.py
===================================================================
--- nibabel-3.1.1.orig/nisext/tests/test_sexts.py
+++ nibabel-3.1.1/nisext/tests/test_sexts.py
@@ -6,7 +6,7 @@ import types
from ..sexts import package_check
-from nose.tools import assert_true, assert_false, assert_equal, assert_raises
+import pytest
FAKE_NAME = 'nisext_improbable'
assert FAKE_NAME not in sys.modules
@@ -15,7 +15,8 @@ FAKE_MODULE = types.ModuleType('nisext_f
def test_package_check():
# Try to use a required package - raise error
- assert_raises(RuntimeError, package_check, FAKE_NAME)
+ with pytest.raises(RuntimeError):
+ package_check(FAKE_NAME)
# Optional, log.warn
package_check(FAKE_NAME, optional=True)
# Can also pass a string
@@ -29,7 +30,8 @@ def test_package_check():
FAKE_MODULE.__version__ = '0.2'
package_check(FAKE_NAME, version='0.2')
# fails when version not good enough
- assert_raises(RuntimeError, package_check, FAKE_NAME, '0.3')
+ with pytest.raises(RuntimeError):
+ package_check(FAKE_NAME, '0.3')
# Unless optional in which case log.warns
package_check(FAKE_NAME, version='0.3', optional=True)
# Might do custom version check
@@ -40,78 +42,63 @@ def test_package_check():
def test_package_check_setuptools():
# If setuptools arg not None, missing package just adds it to arg
- assert_raises(RuntimeError, package_check, FAKE_NAME, setuptools_args=None)
+ with pytest.raises(RuntimeError):
+ package_check(FAKE_NAME, setuptools_args=None)
def pkg_chk_sta(*args, **kwargs):
st_args = {}
package_check(*args, setuptools_args=st_args, **kwargs)
return st_args
- assert_equal(pkg_chk_sta(FAKE_NAME),
- {'install_requires': ['nisext_improbable']})
+ assert pkg_chk_sta(FAKE_NAME) == {'install_requires': ['nisext_improbable']}
# Check that this gets appended to existing value
old_sta = {'install_requires': ['something']}
package_check(FAKE_NAME, setuptools_args=old_sta)
- assert_equal(old_sta,
- {'install_requires': ['something', 'nisext_improbable']})
+ assert old_sta == {'install_requires': ['something', 'nisext_improbable']}
# That existing value as string gets converted to a list
old_sta = {'install_requires': 'something'}
package_check(FAKE_NAME, setuptools_args=old_sta)
- assert_equal(old_sta,
- {'install_requires': ['something', 'nisext_improbable']})
+ assert old_sta == {'install_requires': ['something', 'nisext_improbable']}
# Optional, add to extras_require
- assert_equal(pkg_chk_sta(FAKE_NAME, optional='something'),
- {'extras_require': {'something': ['nisext_improbable']}})
+ assert pkg_chk_sta(FAKE_NAME, optional='something') == {'extras_require': {'something': ['nisext_improbable']}}
# Check that this gets appended to existing value
old_sta = {'extras_require': {'something': ['amodule']}}
package_check(FAKE_NAME, optional='something', setuptools_args=old_sta)
- assert_equal(old_sta,
- {'extras_require':
- {'something': ['amodule', 'nisext_improbable']}})
+ assert old_sta == {'extras_require': {'something': ['amodule', 'nisext_improbable']}}
# That string gets converted to a list here too
old_sta = {'extras_require': {'something': 'amodule'}}
package_check(FAKE_NAME, optional='something', setuptools_args=old_sta)
- assert_equal(old_sta,
- {'extras_require':
- {'something': ['amodule', 'nisext_improbable']}})
+ assert old_sta == {'extras_require':
+ {'something': ['amodule', 'nisext_improbable']}}
# But optional has to be a string if not empty and setuptools_args defined
- assert_raises(RuntimeError,
- package_check, FAKE_NAME, optional=True, setuptools_args={})
+ with pytest.raises(RuntimeError):
+ package_check(FAKE_NAME, optional=True, setuptools_args={})
try:
# Make a package
sys.modules[FAKE_NAME] = FAKE_MODULE
# No install_requires because we already have it
- assert_equal(pkg_chk_sta(FAKE_NAME), {})
+ assert pkg_chk_sta(FAKE_NAME) == {}
# A fake version still works
FAKE_MODULE.__version__ = '0.2'
- assert_equal(pkg_chk_sta(FAKE_NAME, version='0.2'), {})
+ assert pkg_chk_sta(FAKE_NAME, version='0.2') == {}
# goes into install requires when version not good enough
exp_spec = [FAKE_NAME + '>=0.3']
- assert_equal(pkg_chk_sta(FAKE_NAME, version='0.3'),
- {'install_requires': exp_spec})
+ assert pkg_chk_sta(FAKE_NAME, version='0.3') == {'install_requires': exp_spec}
# Unless optional in which case goes into extras_require
package_check(FAKE_NAME, version='0.2', version_getter=lambda x: '0.2')
- assert_equal(
- pkg_chk_sta(FAKE_NAME, version='0.3', optional='afeature'),
- {'extras_require': {'afeature': exp_spec}})
+ assert pkg_chk_sta(FAKE_NAME, version='0.3', optional='afeature') == {'extras_require': {'afeature': exp_spec}}
# Might do custom version check
- assert_equal(
- pkg_chk_sta(FAKE_NAME,
+ assert pkg_chk_sta(FAKE_NAME,
version='0.2',
- version_getter=lambda x: '0.2'),
- {})
+ version_getter=lambda x: '0.2') == {}
# If the version check fails, put into requires
bad_getter = lambda x: x.not_an_attribute
exp_spec = [FAKE_NAME + '>=0.2']
- assert_equal(
- pkg_chk_sta(FAKE_NAME,
+ assert pkg_chk_sta(FAKE_NAME,
version='0.2',
- version_getter=bad_getter),
- {'install_requires': exp_spec})
+ version_getter=bad_getter) == {'install_requires': exp_spec}
# Likewise for optional dependency
- assert_equal(
- pkg_chk_sta(FAKE_NAME,
+ assert pkg_chk_sta(FAKE_NAME,
version='0.2',
optional='afeature',
- version_getter=bad_getter),
- {'extras_require': {'afeature': [FAKE_NAME + '>=0.2']}})
+ version_getter=bad_getter) == {'extras_require': {'afeature': [FAKE_NAME + '>=0.2']}}
finally:
del sys.modules[FAKE_NAME]
Index: nibabel-3.1.1/nisext/tests/test_testers.py
===================================================================
--- nibabel-3.1.1.orig/nisext/tests/test_testers.py
+++ nibabel-3.1.1/nisext/tests/test_testers.py
@@ -6,38 +6,37 @@ from os.path import dirname, pathsep
from ..testers import back_tick, run_mod_cmd, PYTHON
-from nose.tools import assert_true, assert_equal, assert_raises
-
+import pytest
def test_back_tick():
cmd = '{0} -c "print(\'Hello\')"'.format(PYTHON)
- assert_equal(back_tick(cmd), "Hello")
- assert_equal(back_tick(cmd, ret_err=True), ("Hello", ""))
- assert_equal(back_tick(cmd, True, False), (b"Hello", b""))
+ assert back_tick(cmd) == "Hello"
+ assert back_tick(cmd, ret_err=True) == ("Hello", "")
+ assert back_tick(cmd, True, False) == (b"Hello", b"")
cmd = '{0} -c "raise ValueError()"'.format(PYTHON)
- assert_raises(RuntimeError, back_tick, cmd)
+ with pytest.raises(RuntimeError):
+ back_tick(cmd)
def test_run_mod_cmd():
mod = 'os'
mod_dir = dirname(os.__file__)
- assert_equal(run_mod_cmd(mod, mod_dir, "print('Hello')", None, False),
- ("Hello", ""))
+ assert run_mod_cmd(mod, mod_dir, "print('Hello')", None, False) == ("Hello", "")
sout, serr = run_mod_cmd(mod, mod_dir, "print('Hello again')")
- assert_equal(serr, '')
+ assert serr == ''
mod_file, out_str = [s.strip() for s in sout.split('\n')]
- assert_true(mod_file.startswith(mod_dir))
- assert_equal(out_str, 'Hello again')
+ assert mod_file.startswith(mod_dir)
+ assert out_str == 'Hello again'
sout, serr = run_mod_cmd(mod,
mod_dir,
"print(os.environ['PATH'])",
None,
False)
- assert_equal(serr, '')
+ assert serr == ''
sout2, serr = run_mod_cmd(mod,
mod_dir,
"print(os.environ['PATH'])",
'pth2',
False)
- assert_equal(serr, '')
- assert_equal(sout2, '"pth2"' + pathsep + sout)
+ assert serr == ''
+ assert sout2 == '"pth2"' + pathsep + sout

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Fri Jul 10 09:06:52 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- Update to 3.1.1
* Conformation function (``processing.conform``) and CLI tool
(``nib-conform``) to apply shape, orientation and zooms (pr/853) (Jakub
Kaczmarzyk, reviewed by CM, YOH)
* Affine rescaling function (``affines.rescale_affine``) to update
dimensions and voxel sizes (pr/853) (CM, reviewed by Jakub Kaczmarzyk)
* ``kw_only_meth``/``kw_only_func`` decorators are deprecated (pr/848)
(RM, reviewed by CM)
- Add patch purge-nose.patch
-------------------------------------------------------------------
Thu May 21 10:56:36 UTC 2020 - Petr Gajdos <pgajdos@suse.com>

View File

@ -18,14 +18,15 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%define binaries nib-dicomfs nib-diff nib-ls nib-nifti-dx nib-tck2trk nib-trk2tck parrec2nii
%define binaries nib-conform nib-dicomfs nib-diff nib-ls nib-nifti-dx nib-tck2trk nib-trk2tck parrec2nii
Name: python-nibabel
Version: 3.0.1
Version: 3.1.1
Release: 0
Summary: Tool to access multiple neuroimaging data formats
License: MIT
URL: https://nipy.org/nibabel
Source: https://files.pythonhosted.org/packages/source/n/nibabel/nibabel-%{version}.tar.gz
Patch0: purge-nose.patch
BuildRequires: %{python_module setuptools >= 30.3.0}
BuildRequires: %{pythons}
BuildRequires: fdupes
@ -41,7 +42,6 @@ BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module h5py}
BuildRequires: %{python_module nose >= 0.11}
BuildRequires: %{python_module numpy >= 1.12}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module scipy}
@ -58,6 +58,7 @@ very limited support for DICOM.
%prep
%setup -q -n nibabel-%{version}
%patch0 -p1
%build
%python_build
@ -70,7 +71,7 @@ done
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_expand nosetests-%{$python_bin_suffix} -v
%pytest
%post
for b in %{binaries}; do
@ -85,6 +86,7 @@ done
%files %{python_files}
%doc AUTHOR Changelog README.rst
%license COPYING
%python_alternative %{_bindir}/nib-conform
%python_alternative %{_bindir}/nib-dicomfs
%python_alternative %{_bindir}/nib-diff
%python_alternative %{_bindir}/nib-ls