mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 03:09:04 +08:00
Fix passing PYTHONPATH to pytest on Windows
This commit is contained in:
parent
0c215331ee
commit
260c6e983e
@ -22,27 +22,27 @@ function(cura_add_test)
|
|||||||
set(_PYTHONPATH ${_DIRECTORY})
|
set(_PYTHONPATH ${_DIRECTORY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
string(REPLACE "|" "\\;" _PYTHONPATH ${_PYTHONPATH})
|
||||||
|
else()
|
||||||
|
string(REPLACE "|" ":" _PYTHONPATH ${_PYTHONPATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_test(
|
add_test(
|
||||||
NAME ${_NAME}
|
NAME ${_NAME}
|
||||||
COMMAND ${PYTHON_EXECUTABLE} -m pytest --junitxml=${CMAKE_BINARY_DIR}/junit-${_NAME}.xml ${_DIRECTORY}
|
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 LANG=C)
|
||||||
set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT PYTHONPATH=${_PYTHONPATH})
|
set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT "PYTHONPATH=${_PYTHONPATH}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(WIN32)
|
cura_add_test(NAME pytest-main DIRECTORY ${CMAKE_SOURCE_DIR}/tests PYTHONPATH "${CMAKE_SOURCE_DIR}|${URANIUM_DIR}")
|
||||||
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}")
|
|
||||||
|
|
||||||
file(GLOB_RECURSE _plugins plugins/*/__init__.py)
|
file(GLOB_RECURSE _plugins plugins/*/__init__.py)
|
||||||
foreach(_plugin ${_plugins})
|
foreach(_plugin ${_plugins})
|
||||||
get_filename_component(_plugin_directory ${_plugin} DIRECTORY)
|
get_filename_component(_plugin_directory ${_plugin} DIRECTORY)
|
||||||
if(EXISTS ${_plugin_directory}/tests)
|
if(EXISTS ${_plugin_directory}/tests)
|
||||||
get_filename_component(_plugin_name ${_plugin_directory} NAME)
|
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()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user