Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

Commit a10c5fe

Browse files
authored
Replace numpy's deprecated dec with pytest's skipif (#423)
1 parent 755039f commit a10c5fe

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

nistats/tests/test_glm_reporter.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import nibabel as nib
66
import numpy as np
7+
import pytest
78
from nibabel import load
89
from nibabel.tmpdirs import InTemporaryDirectory
910

@@ -13,7 +14,6 @@
1314
from nistats.design_matrix import make_first_level_design_matrix
1415
from nistats.first_level_model import FirstLevelModel
1516
from nistats.reporting import glm_reporter as glmr
16-
from numpy.testing import dec
1717

1818
from nistats.second_level_model import SecondLevelModel
1919

@@ -26,7 +26,8 @@
2626
mpl # So flake8 doesn't complain about not using import (F841)
2727

2828

29-
@dec.skipif(not_have_mpl)
29+
@pytest.mark.skipif(not_have_mpl,
30+
reason='Matplotlib not installed; required for this test')
3031
def test_flm_reporting():
3132
with InTemporaryDirectory():
3233
shapes, rk = ((7, 8, 7, 15), (7, 8, 7, 16)), 3
@@ -50,10 +51,11 @@ def test_flm_reporting():
5051
report_iframe = report_flm.get_iframe()
5152
# So flake8 doesn't complain about not using variable (F841)
5253
report_iframe
53-
del mask, flm
54+
del mask, flm, fmri_data
5455

5556

56-
@dec.skipif(not_have_mpl)
57+
@pytest.mark.skipif(not_have_mpl,
58+
reason='Matplotlib not installed; required for this test')
5759
def test_slm_reporting():
5860
with InTemporaryDirectory():
5961
shapes = ((7, 8, 9, 1),)

nistats/tests/test_reporting.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import nibabel as nib
44
import numpy as np
5+
import pytest
56

67
from nibabel.tmpdirs import InTemporaryDirectory
78
# Set backend to avoid DISPLAY problems
89
from nilearn.plotting import _set_mpl_backend
9-
from numpy.testing import dec
1010

1111
from nistats.design_matrix import make_first_level_design_matrix
1212
from nistats.reporting import (get_clusters_table,
@@ -27,7 +27,8 @@
2727
have_mpl = True
2828

2929

30-
@dec.skipif(not have_mpl)
30+
@pytest.mark.skipif(not have_mpl,
31+
reason='Matplotlib not installed; required for this test')
3132
def test_show_design_matrix():
3233
# test that the show code indeed (formally) runs
3334
frame_times = np.linspace(0, 127 * 1., 128)
@@ -42,7 +43,9 @@ def test_show_design_matrix():
4243
plot_design_matrix(dmtx, output_file='dmtx.pdf')
4344
assert os.path.exists('dmtx.pdf')
4445

45-
@dec.skipif(not have_mpl)
46+
47+
@pytest.mark.skipif(not have_mpl,
48+
reason='Matplotlib not installed; required for this test')
4649
def test_show_contrast_matrix():
4750
# test that the show code indeed (formally) runs
4851
frame_times = np.linspace(0, 127 * 1., 128)

0 commit comments

Comments
 (0)