find_package(Python3 REQUIRED COMPONENTS Interpreter) set(python_test_args --no-header -v "${CMAKE_CURRENT_SOURCE_DIR}/py" --server-binary "$" --worker-binary "$" --client-binary "$" --project-version "${PROJECT_VERSION}") function(add_python_tests name) list(POP_FRONT ARGV) add_test(NAME "${name}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/py" COMMAND ${ARGV}) set_tests_properties("${name}" PROPERTIES TIMEOUT 300) endfunction() add_python_tests(python_tests Python3::Interpreter -m pytest ${python_test_args}) add_python_tests(python_tests_valgrind Python3::Interpreter -m pytest ${python_test_args} --valgrind-binary "${CMAKE_CURRENT_SOURCE_DIR}/../src/valgrind.sh")