Skip to content

Commit 569c348

Browse files
Merge pull request #37936 from peterfpeterson/startup_test_fix_ornlnext
Fix startup tests - ornl-next
2 parents 22dcc1e + c45f8f3 commit 569c348

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

Testing/SystemTests/tests/qt/WorkbenchStartupTest.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
from tempfile import NamedTemporaryFile
1515

1616
TEST_MESSAGE = "Hello Mantid!"
17-
EXECUTABLE_SWITCHER = {"linux": ["launch_mantidworkbench.sh", "mantidworkbench"], "darwin": ["workbench"], "win32": ["workbench.exe"]}
17+
EXECUTABLE_SWITCHER = {
18+
"linux": ["launch_mantidworkbench.sh", "workbench"],
19+
"darwin": ["workbench"],
20+
"win32": ["workbench"],
21+
}
1822
SUBPROCESS_TIMEOUT_SECS = 300
1923

2024

@@ -25,15 +29,6 @@ def get_mantid_executables_for_platform(platform):
2529
return workbench_executables
2630

2731

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-
3732
def start_and_wait_for_completion(args_list):
3833
pids_before_open = set(psutil.pids())
3934
process = subprocess.Popen(args_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -78,18 +73,21 @@ def __init__(self):
7873

7974
self._test_file = NamedTemporaryFile(suffix=".txt", delete=False).name.replace("\\", "/")
8075
self._test_script = NamedTemporaryFile(suffix=".py", delete=False).name.replace("\\", "/")
81-
self._executable = get_mantid_executable_path(sys.platform)
76+
self._executables = get_mantid_executables_for_platform(sys.platform)
8277
write_test_script(self._test_script, self._test_file)
8378

8479
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())
80+
directory = ConfigService.getPropertiesDir().replace("\\", "/")
81+
for executable in self._executables:
82+
file_path = os.path.join(directory, executable)
83+
executable = file_path if os.path.exists(file_path) else executable
84+
exitcode = start_and_wait_for_completion([executable, "--execute", self._test_script, "--quit"])
85+
# Was the process successful
86+
self.assertEqual(0, exitcode)
87+
# Assert that the test script runs successfully by writing to a .txt file
88+
with open(self._test_file, "r") as file:
89+
self.assertEqual(TEST_MESSAGE, file.readline())
90+
remove_file(self._test_file)
9291

9392
def cleanup(self):
9493
remove_file(self._test_script)
95-
remove_file(self._test_file)

qt/applications/workbench/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if(APPLE OR WIN32)
88
endif()
99
add_python_package(workbench EXECUTABLE EGGLINKNAME MantidWorkbench EXCLUDE_FROM_INSTALL ${_exclude_on_install})
1010
# Allow VS to start workbench for debugging
11-
set(_vs_debugger_args "${MSVC_BIN_DIR}/workbench-script.pyw --single-process")
11+
set(_vs_debugger_args "-m workbench --single-process")
1212
# cmake-format: off
1313
set_target_properties(
1414
workbench

0 commit comments

Comments
 (0)