33
44import pytest
55
6- from nipype .interfaces .niftyfit import ( no_niftyfit , get_custom_path , FitDwi ,
7- DwiTool )
6+ from nipype .interfaces .niftyfit import FitDwi , DwiTool
7+ from nipype . interfaces . niftyreg import no_nifty_package , get_custom_path
88from nipype .testing import example_data
99
1010
11- @pytest .mark .skipif (no_niftyfit (cmd = 'fit_dwi' ),
11+ @pytest .mark .skipif (no_nifty_package (cmd = 'fit_dwi' ),
1212 reason = "niftyfit is not installed" )
1313def test_fit_dwi ():
1414 """ Testing FitDwi interface."""
1515 # Create a node object
1616 fit_dwi = FitDwi ()
1717
1818 # Check if the command is properly defined
19- assert fit_dwi .cmd == get_custom_path ('fit_dwi' )
19+ cmd = get_custom_path ('fit_dwi' , env_dir = 'NIFTYFITDIR' )
20+ assert fit_dwi .cmd == cmd
2021
2122 # test raising error with mandatory args absent
2223 with pytest .raises (ValueError ):
@@ -36,7 +37,7 @@ def test_fit_dwi():
3637 {nodiff} -res {res} -rgbmap {rgb} -syn {syn} -tenmap2 {ten2} -v1map {v1}'
3738
3839 expected_cmd = cmd_tmp .format (
39- cmd = get_custom_path ( 'fit_dwi' ) ,
40+ cmd = cmd ,
4041 in_file = in_file ,
4142 bval = bval_file ,
4243 bvec = bvec_file ,
@@ -55,15 +56,16 @@ def test_fit_dwi():
5556 assert fit_dwi .cmdline == expected_cmd
5657
5758
58- @pytest .mark .skipif (no_niftyfit (cmd = 'dwi_tool' ),
59+ @pytest .mark .skipif (no_nifty_package (cmd = 'dwi_tool' ),
5960 reason = "niftyfit is not installed" )
6061def test_dwi_tool ():
6162 """ Testing DwiTool interface."""
6263 # Create a node object
6364 dwi_tool = DwiTool ()
6465
6566 # Check if the command is properly defined
66- assert dwi_tool .cmd == get_custom_path ('dwi_tool' )
67+ cmd = get_custom_path ('dwi_tool' , env_dir = 'NIFTYFITDIR' )
68+ assert dwi_tool .cmd == cmd
6769
6870 # test raising error with mandatory args absent
6971 with pytest .raises (ValueError ):
@@ -86,7 +88,7 @@ def test_dwi_tool():
8688 -mask {mask} -dti -famap {fa} -logdti2 {log} -mcmap {mc} -mdmap {md} \
8789 -rgbmap {rgb} -syn {syn} -v1map {v1}'
8890 expected_cmd = cmd_tmp .format (
89- cmd = get_custom_path ( 'dwi_tool' ) ,
91+ cmd = cmd ,
9092 in_file = in_file ,
9193 bval = bval_file ,
9294 bvec = bvec_file ,
0 commit comments