Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2017-12-29 15:16:52 +0300
committerGhostkeeper <rubend@tutanota.com>2017-12-29 15:16:52 +0300
commitcda600f12d0e03dffdbdbf77a72ba27a85336db2 (patch)
treeebe9ef1f399f2b58484165cd843067c12162e9ea /cmake
parentc786f7a69b46c950712cf32b8d3f341b8c9e7289 (diff)
Don't halt build when encountering duplicate tests
I had duplicate tests because multiple plug-ins were interfering with each other. We shouldn't crash on that. Contributes to issue CURA-4692.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CuraTests.cmake17
1 files changed, 11 insertions, 6 deletions
diff --git a/cmake/CuraTests.cmake b/cmake/CuraTests.cmake
index a8af16c28c..3cb5a705b3 100644
--- a/cmake/CuraTests.cmake
+++ b/cmake/CuraTests.cmake
@@ -28,12 +28,17 @@ function(cura_add_test)
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}")
+ get_test_property(${_NAME} ENVIRONMENT test_exists) #Find out if the test exists by getting a property from it that always exists (such as ENVIRONMENT because we set that ourselves).
+ if (${test_exists} EQUAL "NOTFOUND")
+ 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}")
+ else()
+ message(WARNING "Duplicate test ${_NAME}!")
+ endif()
endfunction()
cura_add_test(NAME pytest-main DIRECTORY ${CMAKE_SOURCE_DIR}/tests PYTHONPATH "${CMAKE_SOURCE_DIR}|${URANIUM_DIR}")