Skip to content
Snippets Groups Projects

Resolve "Tests"

Merged Jean-Baptiste Keck requested to merge 18-tests into master
2 files
+ 15
18
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 11
14
@@ -13,11 +13,17 @@ enable_testing()
find_python_module(pytest REQUIRED)
# === Tests options ===
set(pytest_opt "-v" CACHE INTERNAL "extra options for py.test")
# Force create data directory for tests event if no tests needs it
# because this will we the working directory for all tests.
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/dataForTests)
# Declaration of python test
# Usage:
# add_python_test(name file)
# with 'name' is the name of the test and file the source
# file for the test.
# Add_python_test(name file) with 'name' is the name of the test
# and file the source file for the test.
macro(add_python_test test_name test_file)
add_test(${test_name} py.test "${pytest_opt}" ${test_file})
set_tests_properties(${test_name} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILURE;Exception;[^x]failed;ERROR;Assertion")
@@ -45,16 +51,8 @@ endmacro()
# --> set test dir
set(testDir ${HYSOP_BUILD_PYTHONPATH})
# === Tests options ===
if(FULL_TEST)
set(pytest_opt "-s -v -pep8" CACHE INTERNAL "extra options for py.test")
else()
set(pytest_opt "-v" CACHE INTERNAL "extra options for py.test")
endif()
# === Set the list of all directories which may contain tests ===
set(py_src_dirs operator)
set(py_src_dirs core/arrays fields operator)
# === Create the files list from all directories in py_src_dirs ===
@@ -63,7 +61,7 @@ set(py_test_files)
foreach(testdir ${py_src_dirs})
file(GLOB testfiles RELATIVE ${CMAKE_SOURCE_DIR} hysop/${testdir}/tests/test_*.py)
set(py_test_files ${py_test_files} ${testfiles})
# copy data files
# copy data files required by the tests
file(GLOB reffiles hysop/${testdir}/tests/ref_files/*)
file(COPY ${reffiles} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/dataForTests)
endforeach()
@@ -83,7 +81,6 @@ foreach(testdir ${py_src_dirs})
endforeach()
endforeach()
# === Create tests from py_test_files ===
foreach(testfile ${py_test_files})
set(execname ${CMAKE_SOURCE_DIR}/${testfile})
Loading