Skip to content

Commit 430fda9

Browse files
authored
Merge pull request #835 from djarecka/ci/pytest_nibabeltests
Ci/pytest nibabeltests
2 parents b2a88b8 + 6748c6d commit 430fda9

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

.azure-pipelines/windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
- script: |
3131
python -m pip install --find-links %EXTRA_WHEELS% %DEPENDS%
3232
python -m pip install nose mock coverage codecov
33+
python -m pip install pytest
3334
displayName: 'Install dependencies'
3435
- script: |
3536
python -m pip install .
@@ -40,6 +41,7 @@ jobs:
4041
cd for_testing
4142
cp ../.coveragerc .
4243
nosetests --with-doctest --with-coverage --cover-package nibabel nibabel
44+
pytest -v ../nibabel/tests/test_affines.py
4345
displayName: 'Nose tests'
4446
- script: |
4547
cd for_testing

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ script:
132132
cd for_testing
133133
cp ../.coveragerc .
134134
nosetests --with-doctest --with-coverage --cover-package nibabel nibabel
135+
pytest -v ../nibabel/tests/test_affines.py
135136
else
136137
false
137138
fi

nibabel/tests/test_affines.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from_matvec, dot_reduce, voxel_sizes, obliquity)
1111

1212

13-
from nose.tools import assert_equal, assert_raises
13+
import pytest
1414
from numpy.testing import assert_array_equal, assert_almost_equal, \
1515
assert_array_almost_equal
1616

@@ -80,7 +80,7 @@ def test_matrix_vector():
8080
vec = xform[:-1, -1]
8181
assert_array_equal(newmat, mat)
8282
assert_array_equal(newvec, vec)
83-
assert_equal(newvec.shape, (M - 1,))
83+
assert newvec.shape == (M - 1,)
8484
assert_array_equal(from_matvec(mat, vec), xform)
8585
# Check default translation works
8686
xform_not = xform[:]
@@ -126,17 +126,19 @@ def test_append_diag():
126126
[0, 0, 0, 5, 9],
127127
[0, 0, 0, 0, 1]])
128128
# Length of starts has to match length of steps
129-
assert_raises(AffineError, append_diag, aff, [5, 6], [9])
129+
with pytest.raises(AffineError):
130+
append_diag(aff, [5, 6], [9])
130131

131132

132133
def test_dot_reduce():
133134
# Chaining numpy dot
134135
# Error for no arguments
135-
assert_raises(TypeError, dot_reduce)
136+
with pytest.raises(TypeError):
137+
dot_reduce()
136138
# Anything at all on its own, passes through
137-
assert_equal(dot_reduce(1), 1)
138-
assert_equal(dot_reduce(None), None)
139-
assert_equal(dot_reduce([1, 2, 3]), [1, 2, 3])
139+
assert dot_reduce(1) == 1
140+
assert dot_reduce(None) is None
141+
assert dot_reduce([1, 2, 3]) == [1, 2, 3]
140142
# Two or more -> dot product
141143
vec = [1, 2, 3]
142144
mat = np.arange(4, 13).reshape((3, 3))

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ install_requires =
3333
numpy >=1.12
3434
tests_require =
3535
nose >=0.11
36+
pytest
3637
mock
3738
test_suite = nose.collector
3839
zip_safe = False
@@ -54,6 +55,7 @@ test =
5455
coverage
5556
mock
5657
nose >=0.11
58+
pytest
5759
all =
5860
%(dicom)s
5961
%(doc)s

0 commit comments

Comments
 (0)