Skip to content

Commit 849fa41

Browse files
committed
TEST: Increase coverage, decrease noise
1 parent 999a538 commit 849fa41

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

smriprep/workflows/tests/test_anatomical.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
BASE_LAYOUT = {
1313
"01": {
14-
"anat": [{"suffix": "T1w"}, {"suffix": "T2w"}],
14+
"anat": [
15+
{"run": 1, "suffix": "T1w"},
16+
{"run": 2, "suffix": "T1w"},
17+
{"suffix": "T2w"},
18+
],
1519
"func": [
1620
{
1721
"task": "rest",
@@ -39,6 +43,17 @@
3943
}
4044

4145

46+
@pytest.fixture(scope="module", autouse=True)
47+
def quiet_logger():
48+
import logging
49+
50+
logger = logging.getLogger("nipype.workflow")
51+
old_level = logger.getEffectiveLevel()
52+
logger.setLevel(logging.ERROR)
53+
yield
54+
logger.setLevel(old_level)
55+
56+
4257
@pytest.fixture(scope="module")
4358
def bids_root(tmp_path_factory):
4459
base = tmp_path_factory.mktemp("base")
@@ -115,6 +130,8 @@ def test_anat_fit_wf(
115130
@pytest.mark.parametrize("t1w_mask", [False, True])
116131
@pytest.mark.parametrize("t1w_dseg", [False, True])
117132
@pytest.mark.parametrize("t1w_tpms", [False, True])
133+
@pytest.mark.parametrize("t1w", [1, 2])
134+
@pytest.mark.parametrize("t2w", [0, 1])
118135
def test_anat_fit_precomputes(
119136
bids_root: Path,
120137
tmp_path: Path,
@@ -123,10 +140,18 @@ def test_anat_fit_precomputes(
123140
t1w_mask: bool,
124141
t1w_dseg: bool,
125142
t1w_tpms: bool,
143+
t1w: int,
144+
t2w: int,
126145
):
127146
output_dir = tmp_path / 'output'
128147
output_dir.mkdir()
129148

149+
t1w_list = [
150+
str(bids_root / "sub-01" / "anat" / "sub-01_run-1_T1w.nii.gz"),
151+
str(bids_root / "sub-01" / "anat" / "sub-01_run-2_T1w.nii.gz"),
152+
][:t1w]
153+
t2w_list = [str(bids_root / "sub-01" / "anat" / "sub-01_T2w.nii.gz")][:t2w]
154+
130155
empty_img = nb.Nifti1Image(np.zeros((1, 1, 1)), np.eye(4))
131156
precomputed = {}
132157
if t1w_preproc:
@@ -146,12 +171,12 @@ def test_anat_fit_precomputes(
146171
init_anat_fit_wf(
147172
bids_root=str(bids_root),
148173
output_dir=str(output_dir),
149-
freesurfer=False,
174+
freesurfer=True,
150175
hires=False,
151176
longitudinal=False,
152177
msm_sulc=True,
153-
t1w=[str(bids_root / "sub-01" / "anat" / "sub-01_T1w.nii.gz")],
154-
t2w=[str(bids_root / "sub-01" / "anat" / "sub-01_T2w.nii.gz")],
178+
t1w=t1w_list,
179+
t2w=t2w_list,
155180
skull_strip_mode='force',
156181
skull_strip_template=Reference("OASIS30ANTs"),
157182
spaces=SpatialReferences(

0 commit comments

Comments
 (0)