diff options
author | Jack Ha <j.ha@ultimaker.com> | 2017-03-16 12:51:53 +0300 |
---|---|---|
committer | Jack Ha <j.ha@ultimaker.com> | 2017-03-16 12:51:53 +0300 |
commit | 260c6e983ea78c43fa613f9b1911f53a94c30815 (patch) | |
tree | 73298121afe2ece114e60fdb89ec88044307fbf7 /cmake/CuraTests.cmake | |
parent | 0c215331ee78d3afda624241317ff75f3bee9d2e (diff) |
Fix passing PYTHONPATH to pytest on Windows
Diffstat (limited to 'cmake/CuraTests.cmake')
-rw-r--r-- | cmake/CuraTests.cmake | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cmake/CuraTests.cmake b/cmake/CuraTests.cmake index 604f93d7e3..eca96257cc 100644 --- a/cmake/CuraTests.cmake +++ b/cmake/CuraTests.cmake @@ -21,28 +21,28 @@ function(cura_add_test) if(NOT _PYTHONPATH) set(_PYTHONPATH ${_DIRECTORY}) endif() + + if(WIN32) + string(REPLACE "|" "\\;" _PYTHONPATH ${_PYTHONPATH}) + else() + string(REPLACE "|" ":" _PYTHONPATH ${_PYTHONPATH}) + endif() add_test( NAME ${_NAME} COMMAND ${PYTHON_EXECUTABLE} -m pytest --junitxml=${CMAKE_BINARY_DIR}/junit-${_NAME}.xml ${_DIRECTORY} ) set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT LANG=C) - set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT PYTHONPATH=${_PYTHONPATH}) + set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT "PYTHONPATH=${_PYTHONPATH}") endfunction() -if(WIN32) - set(_path_sep ";") -else() - set(_path_sep ":") -endif() - -cura_add_test(NAME pytest-main DIRECTORY ${CMAKE_SOURCE_DIR}/tests PYTHONPATH "${CMAKE_SOURCE_DIR}${_path_sep}${URANIUM_DIR}") +cura_add_test(NAME pytest-main DIRECTORY ${CMAKE_SOURCE_DIR}/tests PYTHONPATH "${CMAKE_SOURCE_DIR}|${URANIUM_DIR}") file(GLOB_RECURSE _plugins plugins/*/__init__.py) foreach(_plugin ${_plugins}) get_filename_component(_plugin_directory ${_plugin} DIRECTORY) if(EXISTS ${_plugin_directory}/tests) get_filename_component(_plugin_name ${_plugin_directory} NAME) - cura_add_test(NAME pytest-${_plugin_name} DIRECTORY ${_plugin_directory} PYTHONPATH "${_plugin_directory}${_path_sep}${CMAKE_SOURCE_DIR}${_path_sep}${URANIUM_DIR}") + cura_add_test(NAME pytest-${_plugin_name} DIRECTORY ${_plugin_directory} PYTHONPATH "${_plugin_directory}|${CMAKE_SOURCE_DIR}|${URANIUM_DIR}") endif() endforeach() |