Test with debug build of Python when DEBUG=1 on Travis

This commit is contained in:
Dean Moldovan 2017-02-27 15:42:51 +01:00 committed by Wenzel Jakob
parent 5fe9908b7a
commit 620a808ad0
3 changed files with 10 additions and 2 deletions

View File

@ -147,9 +147,13 @@ install:
- |
# Install dependencies
if [ -n "$DOCKER" ]; then
if [ -n "$DEBUG" ]; then
PY_DEBUG="python$PY-dbg python$PY-scipy-dbg"
export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE=/usr/bin/python${PYTHON}dm"
fi
docker exec --tty "$containerid" sh -c "for s in 0 15; do sleep \$s; \
apt-get -qy --no-install-recommends $APT_GET_EXTRA install \
python$PY-dev python$PY-pytest python$PY-scipy \
$PY_DEBUG python$PY-dev python$PY-pytest python$PY-scipy \
libeigen3-dev cmake make ${COMPILER_PACKAGES} && break; done"
else
pip install numpy scipy pytest

View File

@ -159,7 +159,7 @@ if(NOT PYBIND11_PYTEST_FOUND)
endif()
# A single command to compile and run the tests
add_custom_target(pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest -rws ${PYBIND11_PYTEST_FILES}
add_custom_target(pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest -rws --capture=sys ${PYBIND11_PYTEST_FILES}
DEPENDS pybind11_tests WORKING_DIRECTORY ${testdir})
if(PYBIND11_TEST_OVERRIDE)

View File

@ -14,5 +14,9 @@ target_link_libraries(test_cmake_build PRIVATE pybind11::module)
set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")
# Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::module).
# This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$<TARGET_FILE_DIR:test_cmake_build>
${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})