From 46b032f84fc7623887b3e88d07b14a9020f09dfd Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 29 May 2017 12:35:31 +0900 Subject: [PATCH] Added option NOSE_OPT to catkin_add_nosetests func In order to use some specific option for nosetests we now have a NOSE_OPT parameter that allow to use some customs options for launching nosetests The same has been done for pytests with the param PYTEST_OPT --- cmake/nosetests.cmake.in | 12 ++++++++---- cmake/pytest.cmake.in | 8 ++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmake/nosetests.cmake.in b/cmake/nosetests.cmake.in index 85d8eb9..a286511 100644 --- a/cmake/nosetests.cmake.in +++ b/cmake/nosetests.cmake.in @@ -23,6 +23,9 @@ _generate_function_if_testing_is_disabled("catkin_add_nosetests") # tests (this option can only be used when the ``path`` argument is a # file but not when it is a directory) # :type WORKING_DIRECTORY: string +# :param NOSE_OPT: additional options to be used to run pytest, this param +# should be used only if the other ones do not fulfill you requirements to +# properly run your pytests. # # @public # @@ -34,7 +37,8 @@ function(catkin_add_nosetests path) return() endif() - cmake_parse_arguments(_nose "" "TIMEOUT;WORKING_DIRECTORY" "DEPENDENCIES" ${ARGN}) + + cmake_parse_arguments(_nose "" "TIMEOUT;WORKING_DIRECTORY;NOSE_OPT" "DEPENDENCIES" ${ARGN}) if(NOT _nose_TIMEOUT) set(_nose_TIMEOUT 60) endif() @@ -79,8 +83,8 @@ function(catkin_add_nosetests path) else() set(tests "${_path_name}") endif() - set(cmd ${cmd} "${CATKIN_ENV} ${CATKIN_PIP_NOSETESTS} -P --process-timeout=${_nose_TIMEOUT} ${tests} --with-xunit --xunit-file=${output_path}/nosetests-${output_file_name}.xml${_covarg}") - catkin_run_tests_target("nosetests" ${output_file_name} "nosetests-${output_file_name}.xml" COMMAND ${cmd} DEPENDENCIES ${_nose_DEPENDENCIES} WORKING_DIRECTORY ${_nose_WORKING_DIRECTORY}) + set(cmd ${cmd} "${CATKIN_ENV} ${CATKIN_PIP_NOSETESTS} -P --process-timeout=${_nose_TIMEOUT} ${tests} ${_nose_NOSE_OPT} --with-xunit --xunit-file=${output_path}/nosetests-${output_file_name}.xml${_covarg}") + catkin_run_tests_target("nosetests" ${output_file_name} "nosetests-${output_file_name}.xml" COMMAND ${cmd} DEPENDENCIES ${_nose_DEPENDENCIES} WORKING_DIRECTORY ${_nose_WORKING_DIRECTORY}) endfunction() # Providing another catkin nosetests usage... @@ -119,4 +123,4 @@ macro(_strip_path_prefix var value prefix) endif() endif() endif() -endmacro() \ No newline at end of file +endmacro() diff --git a/cmake/pytest.cmake.in b/cmake/pytest.cmake.in index 32cf7c2..30de120 100644 --- a/cmake/pytest.cmake.in +++ b/cmake/pytest.cmake.in @@ -23,6 +23,10 @@ _generate_function_if_testing_is_disabled("catkin_add_pytests") # tests (this option can only be used when the ``path`` argument is a # file but not when it is a directory) # :type WORKING_DIRECTORY: string +# :param PYTEST_OPT: additional options to be used to run pytest, this param +# should be used only if the other ones do not fullfill you requirements to +# properly run your pytests. +# :type PYTEST_OPT: string # # @public # @@ -34,7 +38,7 @@ function(catkin_add_pytests path) return() endif() - cmake_parse_arguments(_pytest "" "TIMEOUT;WORKING_DIRECTORY" "DEPENDENCIES" ${ARGN}) + cmake_parse_arguments(_pytest "" "TIMEOUT;WORKING_DIRECTORY;PYTEST_OPT" "DEPENDENCIES" ${ARGN}) if(NOT _pytest_TIMEOUT) set(_pytest_TIMEOUT 60) endif() @@ -74,7 +78,7 @@ function(catkin_add_pytests path) get_filename_component(output_path "${output_path}" ABSOLUTE) set(cmd "${CMAKE_COMMAND} -E make_directory ${output_path}") set(tests "${_path_name}") - set(cmd ${cmd} "${CATKIN_ENV} ${CATKIN_PIP_PYTEST} --timeout=${_pytest_TIMEOUT} ${tests} --junit-xml ${output_path}/pytests-${output_file_name}.xml ${_covarg}") + set(cmd ${cmd} "${CATKIN_ENV} ${CATKIN_PIP_PYTEST} --timeout=${_pytest_TIMEOUT} ${tests} ${_pytest_PYTEST_OPT} --junit-xml ${output_path}/pytests-${output_file_name}.xml ${_covarg}") catkin_run_tests_target("pytests" ${output_file_name} "pytests-${output_file_name}.xml" COMMAND ${cmd} DEPENDENCIES ${_pytest_DEPENDENCIES} WORKING_DIRECTORY ${_pytest_WORKING_DIRECTORY}) endfunction()