File tree Expand file tree Collapse file tree 2 files changed +6
-20
lines changed Expand file tree Collapse file tree 2 files changed +6
-20
lines changed Original file line number Diff line number Diff line change 17
17
18
18
19
19
def get_matlab_command ():
20
- if "NIPYPE_NO_MATLAB" in os .environ :
21
- return None
22
-
23
- try :
24
- matlab_cmd = os .environ ["MATLABCMD" ]
25
- except :
26
- matlab_cmd = "matlab"
27
-
28
- try :
29
- res = CommandLine (
30
- command = "which" ,
31
- args = matlab_cmd ,
32
- resource_monitor = False ,
33
- terminal_output = "allatonce" ,
34
- ).run ()
35
- matlab_path = res .runtime .stdout .strip ()
36
- except Exception :
37
- return None
38
- return matlab_cmd
20
+ """Determine whether Matlab is installed and can be executed."""
21
+ if "NIPYPE_NO_MATLAB" not in os .environ :
22
+ from nipype .utils .filemanip import which
23
+
24
+ return which (os .getenv ("MATLABCMD" , "matlab" ))
39
25
40
26
41
27
no_matlab = get_matlab_command () is None
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ def test_run_interface(tmpdir):
103
103
# bypasses ubuntu dash issue
104
104
mc = mlab .MatlabCommand (script = "foo;" , paths = [tmpdir .strpath ], mfile = True )
105
105
assert not os .path .exists (default_script_file ), "scriptfile should not exist 4."
106
- with pytest .raises (RuntimeError ):
106
+ with pytest .raises (OSError ):
107
107
mc .run ()
108
108
assert os .path .exists (default_script_file ), "scriptfile should exist 4."
109
109
if os .path .exists (default_script_file ): # cleanup
You can’t perform that action at this time.
0 commit comments