Skip to content

Commit 3460d6a

Browse files
authored
Merge pull request #1979 from djarecka/interfaces_tests_edit
small edit of the MCFLIRT tests
2 parents 38fa3d5 + 9c74054 commit 3460d6a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

nipype/interfaces/fsl/tests/test_preprocess.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ def test_mcflirt(setup_flirt):
324324
realcmd = 'mcflirt -in ' + infile + ' -out ' + outfile2
325325
assert frt.cmdline == realcmd
326326

327+
328+
@pytest.mark.skipif(no_fsl(), reason="fsl is not installed")
329+
def test_mcflirt_opt(setup_flirt):
330+
tmpdir, infile, reffile = setup_flirt
331+
_, nme = os.path.split(infile)
332+
327333
opt_map = {
328334
'cost': ('-cost mutualinfo', 'mutualinfo'),
329335
'bins': ('-bins 256', 256),
@@ -344,6 +350,9 @@ def test_mcflirt(setup_flirt):
344350

345351
for name, settings in list(opt_map.items()):
346352
fnt = fsl.MCFLIRT(in_file=infile, **{name: settings[1]})
353+
outfile = os.path.join(os.getcwd(), nme)
354+
outfile = fnt._gen_fname(outfile, suffix='_mcf')
355+
347356
instr = '-in %s' % (infile)
348357
outstr = '-out %s' % (outfile)
349358
if name in ('init', 'cost', 'dof', 'mean_vol', 'bins'):
@@ -357,10 +366,14 @@ def test_mcflirt(setup_flirt):
357366
outstr,
358367
settings[0]])
359368

369+
370+
@pytest.mark.skipif(no_fsl(), reason="fsl is not installed")
371+
def test_mcflirt_noinput():
360372
# Test error is raised when missing required args
361373
fnt = fsl.MCFLIRT()
362-
with pytest.raises(ValueError):
374+
with pytest.raises(ValueError) as excinfo:
363375
fnt.run()
376+
assert str(excinfo.value).startswith("MCFLIRT requires a value for input 'in_file'")
364377

365378
# test fnirt
366379

0 commit comments

Comments
 (0)