mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-25 05:52:32 +03:00
add pytest as a test goal in cmake
This commit is contained in:
parent
eb3b789855
commit
f1f0032758
@ -140,31 +140,59 @@ if (BUILD_TESTS)
|
|||||||
|
|
||||||
set(TEST_BDD db osm2pgsql api)
|
set(TEST_BDD db osm2pgsql api)
|
||||||
|
|
||||||
|
find_program(PYTHON_BEHAVE behave)
|
||||||
find_program(PYLINT NAMES pylint3 pylint)
|
find_program(PYLINT NAMES pylint3 pylint)
|
||||||
|
find_program(PYTEST pytest)
|
||||||
|
find_program(PHPCS phpcs)
|
||||||
|
find_program(PHPUNIT phpunit)
|
||||||
|
|
||||||
foreach (test ${TEST_BDD})
|
if (PYTHON_BEHAVE)
|
||||||
add_test(NAME bdd_${test}
|
message(STATUS "Using Python behave binary ${PYTHON_BEHAVE}")
|
||||||
COMMAND behave ${test}
|
foreach (test ${TEST_BDD})
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/bdd)
|
add_test(NAME bdd_${test}
|
||||||
set_tests_properties(bdd_${test}
|
COMMAND ${PYTHON_BEHAVE} ${test}
|
||||||
PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/bdd)
|
||||||
endforeach()
|
set_tests_properties(bdd_${test}
|
||||||
|
PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
message(WARNING "behave not found. BDD tests disabled." )
|
||||||
|
endif()
|
||||||
|
|
||||||
add_test(NAME php
|
if (PHPUNIT)
|
||||||
COMMAND phpunit ./
|
message(STATUS "Using phpunit binary ${PHPUNIT}")
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/php)
|
add_test(NAME php
|
||||||
|
COMMAND ${PHPUNIT} ./
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/php)
|
||||||
|
else()
|
||||||
|
message(WARNING "phpunit not found. PHP unit tests disabled." )
|
||||||
|
endif()
|
||||||
|
|
||||||
add_test(NAME phpcs
|
if (PHPCS)
|
||||||
COMMAND phpcs --report-width=120 --colors lib website utils
|
message(STATUS "Using phpcs binary ${PHPCS}")
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
add_test(NAME phpcs
|
||||||
|
COMMAND ${PHPCS} --report-width=120 --colors lib website utils
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||||
|
else()
|
||||||
|
message(WARNING "phpcs not found. PHP linting tests disabled." )
|
||||||
|
endif()
|
||||||
|
|
||||||
if (PYLINT)
|
if (PYLINT)
|
||||||
message(STATUS "Using '${PYLINT}' for Python linting.")
|
message(STATUS "Using pylint binary ${PYLINT}")
|
||||||
add_test(NAME pylint
|
add_test(NAME pylint
|
||||||
COMMAND ${PYLINT} nominatim
|
COMMAND ${PYLINT} nominatim
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||||
else()
|
else()
|
||||||
message(STATUS "pylint not found. Linting tests disabled.")
|
message(WARNING "pylint not found. Python linting tests disabled.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (PYTEST)
|
||||||
|
message(STATUS "Using pytest binary ${PYTEST}")
|
||||||
|
add_test(NAME pytest
|
||||||
|
COMMAND ${PYTEST} test/python
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||||
|
else()
|
||||||
|
message(WARNING "pytest not found. Python tests disabled." )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user