10
10
import sys
11
11
import systemtesting
12
12
13
- from mantid .kernel import ConfigService
14
13
from tempfile import NamedTemporaryFile
15
14
16
15
TEST_MESSAGE = "Hello Mantid!"
17
- EXECUTABLE_SWITCHER = {"linux" : ["launch_mantidworkbench.sh" , "mantidworkbench" ], "darwin" : ["workbench" ], "win32" : ["workbench.exe" ]}
16
+ EXECUTABLE_SWITCHER = {
17
+ "linux" : ["launch_mantidworkbench.sh" , "mantidworkbench" , "workbench" ],
18
+ "darwin" : ["workbench" ],
19
+ "win32" : ["workbench" ],
20
+ }
18
21
SUBPROCESS_TIMEOUT_SECS = 300
19
22
20
23
@@ -25,15 +28,6 @@ def get_mantid_executables_for_platform(platform):
25
28
return workbench_executables
26
29
27
30
28
- def get_mantid_executable_path (platform ):
29
- directory = ConfigService .getPropertiesDir ().replace ("\\ " , "/" )
30
- for executable in get_mantid_executables_for_platform (platform ):
31
- workbench_exe = os .path .join (directory , executable )
32
- if os .path .exists (workbench_exe ):
33
- return workbench_exe
34
- raise RuntimeError (f"Could not find path to { workbench_exe } . Tried { get_mantid_executables_for_platform (platform )} " )
35
-
36
-
37
31
def start_and_wait_for_completion (args_list ):
38
32
pids_before_open = set (psutil .pids ())
39
33
process = subprocess .Popen (args_list , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
@@ -78,18 +72,18 @@ def __init__(self):
78
72
79
73
self ._test_file = NamedTemporaryFile (suffix = ".txt" , delete = False ).name .replace ("\\ " , "/" )
80
74
self ._test_script = NamedTemporaryFile (suffix = ".py" , delete = False ).name .replace ("\\ " , "/" )
81
- self ._executable = get_mantid_executable_path (sys .platform )
75
+ self ._executables = get_mantid_executables_for_platform (sys .platform )
82
76
write_test_script (self ._test_script , self ._test_file )
83
77
84
78
def runTest (self ):
85
- exitcode = start_and_wait_for_completion ([self ._executable , "--execute" , self ._test_script , "--quit" ])
86
-
87
- # Was the process successful
88
- self .assertEqual (0 , exitcode )
89
- # Assert that the test script runs successfully by writing to a .txt file
90
- with open (self ._test_file , "r" ) as file :
91
- self .assertEqual (TEST_MESSAGE , file .readline ())
79
+ for executable in self ._executables :
80
+ exitcode = start_and_wait_for_completion ([executable , "--execute" , self ._test_script , "--quit" ])
81
+ # Was the process successful
82
+ self .assertEqual (0 , exitcode )
83
+ # Assert that the test script runs successfully by writing to a .txt file
84
+ with open (self ._test_file , "r" ) as file :
85
+ self .assertEqual (TEST_MESSAGE , file .readline ())
86
+ remove_file (self ._test_file )
92
87
93
88
def cleanup (self ):
94
89
remove_file (self ._test_script )
95
- remove_file (self ._test_file )
0 commit comments