Commit 7ee2b8a2 authored by Samuel Debionne's avatar Samuel Debionne

Add a function to run python test int LimaTools

The function set the PATH and PYTHONPATH and runs the given python script.
parent 6ea82531
Pipeline #2964 failed with stages
in 1 minute and 36 seconds
......@@ -25,3 +25,6 @@ if (NOT WIN32)
set(test_src ${test_src} test_simulator_hwbuffersave test_simulator_framebuilder)
endif()
limatools_run_camera_tests("${test_src}" ${NAME})
set(python_test_src test_prepare_timeout)
limatools_run_camera_python_tests("${python_test_src}" ${NAME})
......@@ -160,12 +160,12 @@ def main(argv):
try:
test_control.start(exp_time, nb_frames, prepare_timeout,
sleep_time)
except Core.Exception, e:
except Core.Exception as e:
if err in e.args[0]:
ok = True
deb.Always('Got good exception: %s' % e)
if not ok:
raise RuntimeError, 'Expected exception: %s' % err
raise RuntimeError('Expected exception: %s' % err)
if __name__ == '__main__':
main(sys.argv)
......@@ -46,6 +46,23 @@ function(limatools_run_camera_tests test_src cam_name)
endfunction()
function(limatools_run_camera_python_tests test_src cam_name)
foreach(file ${test_src})
add_test(NAME ${file}
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/${file}.py)
if(WIN32)
# Add the dlls to the %PATH%
string(REPLACE ";" "\;" ESCAPED_PATH "$ENV{PATH}")
set_tests_properties(${file} PROPERTIES ENVIRONMENT "PATH=${ESCAPED_PATH}\;$<SHELL_PATH:$<TARGET_FILE_DIR:limacore>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:processlib>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:lima${cam_name}>>;PYTHONPATH=$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_limacore>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_processlib>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_lima${cam_name}>>")
else()
set_tests_properties(${file} PROPERTIES ENVIRONMENT "PYTHONPATH=$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_limacore>>:$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_processlib>>:$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_lima${cam_name}>>")
endif()
endforeach(file)
endfunction()
function(limatools_run_sip_for_camera cam_name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment