File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ libignition-cmake2-dev
33libpython3-dev
44python3-distutils
55python3-pybind11
6+ python3-pytest
67ruby-dev
78swig
Original file line number Diff line number Diff line change @@ -141,9 +141,25 @@ if (BUILD_TESTING)
141141 Vector4_TEST
142142 )
143143
144+ execute_process (COMMAND "${Python3_EXECUTABLE} " -m pytest --version
145+ OUTPUT_VARIABLE PYTEST_output
146+ ERROR_VARIABLE PYTEST_error
147+ RESULT_VARIABLE PYTEST_result )
148+ if (${PYTEST_result} EQUAL 0)
149+ set (pytest_FOUND TRUE )
150+ else ()
151+ message ("" )
152+ message (WARNING "Pytest package not available: ${PYTEST_error} " )
153+ endif ()
154+
144155 foreach (test ${python_tests} )
145- add_test (NAME ${test} .py COMMAND
146- "${PYTHON_EXECUTABLE} " "${CMAKE_SOURCE_DIR} /src/python_pybind11/test/${test} .py" )
156+ if (pytest_FOUND)
157+ add_test (NAME ${test} .py COMMAND
158+ "${Python3_EXECUTABLE} " -m pytest "${CMAKE_SOURCE_DIR} /src/python_pybind11/test/${test} .py" --junitxml "${CMAKE_BINARY_DIR} /test_results/${test} .xml" )
159+ else ()
160+ add_test (NAME ${test} .py COMMAND
161+ "${Python3_EXECUTABLE} " "${CMAKE_SOURCE_DIR} /src/python_pybind11/test/${test} .py" )
162+ endif ()
147163
148164 set (_env_vars)
149165 list (APPEND _env_vars "PYTHONPATH=${FAKE_INSTALL_PREFIX} /lib/python/" )
You can’t perform that action at this time.
0 commit comments