Skip to content

Commit 056e996

Browse files
jclarkeSTFCjhaigh0
andcommitted
The .exe file is no longer produced in a dev build
Since we switched to pip install --editable instead of calling setup.py directly, we no longer get an executable file in the build output, so this test needed adjusting. It was also attempting to do a for loop and returning at the first entry so we fixed that. Co-authored-by: Jonathan Haigh <jonathan.haigh@stfc.ac.uk>
1 parent dbe9e38 commit 056e996

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

Testing/SystemTests/tests/qt/WorkbenchStartupTest.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
import sys
1111
import systemtesting
1212

13-
from mantid.kernel import ConfigService
1413
from tempfile import NamedTemporaryFile
1514

1615
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+
}
1821
SUBPROCESS_TIMEOUT_SECS = 300
1922

2023

@@ -25,15 +28,6 @@ def get_mantid_executables_for_platform(platform):
2528
return workbench_executables
2629

2730

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-
3731
def start_and_wait_for_completion(args_list):
3832
pids_before_open = set(psutil.pids())
3933
process = subprocess.Popen(args_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -78,18 +72,18 @@ def __init__(self):
7872

7973
self._test_file = NamedTemporaryFile(suffix=".txt", delete=False).name.replace("\\", "/")
8074
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)
8276
write_test_script(self._test_script, self._test_file)
8377

8478
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)
9287

9388
def cleanup(self):
9489
remove_file(self._test_script)
95-
remove_file(self._test_file)

0 commit comments

Comments
 (0)