Skip to content

Commit 620a808

Browse files
dean0x7dwjakob
authored andcommitted
Test with debug build of Python when DEBUG=1 on Travis
1 parent 5fe9908 commit 620a808

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,13 @@ install:
147147
- |
148148
# Install dependencies
149149
if [ -n "$DOCKER" ]; then
150+
if [ -n "$DEBUG" ]; then
151+
PY_DEBUG="python$PY-dbg python$PY-scipy-dbg"
152+
export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE=/usr/bin/python${PYTHON}dm"
153+
fi
150154
docker exec --tty "$containerid" sh -c "for s in 0 15; do sleep \$s; \
151155
apt-get -qy --no-install-recommends $APT_GET_EXTRA install \
152-
python$PY-dev python$PY-pytest python$PY-scipy \
156+
$PY_DEBUG python$PY-dev python$PY-pytest python$PY-scipy \
153157
libeigen3-dev cmake make ${COMPILER_PACKAGES} && break; done"
154158
else
155159
pip install numpy scipy pytest

tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if(NOT PYBIND11_PYTEST_FOUND)
159159
endif()
160160

161161
# A single command to compile and run the tests
162-
add_custom_target(pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest -rws ${PYBIND11_PYTEST_FILES}
162+
add_custom_target(pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest -rws --capture=sys ${PYBIND11_PYTEST_FILES}
163163
DEPENDS pybind11_tests WORKING_DIRECTORY ${testdir})
164164

165165
if(PYBIND11_TEST_OVERRIDE)

tests/test_cmake_build/installed_target/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ target_link_libraries(test_cmake_build PRIVATE pybind11::module)
1414
set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
1515
SUFFIX "${PYTHON_MODULE_EXTENSION}")
1616

17+
# Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::module).
18+
# This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
19+
set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
20+
1721
add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$<TARGET_FILE_DIR:test_cmake_build>
1822
${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})

0 commit comments

Comments
 (0)