@@ -68,6 +68,9 @@ endif()
6868pybind11_add_module(pybind11_tests pybind11_tests.cpp
6969 ${PYBIND11_TEST_FILES} ${PYBIND11_HEADERS} )
7070
71+ pybind11_add_module(pybind11_test_broken_import pybind11_test_broken_import.cpp
72+ ${PYBIND11_HEADERS} )
73+
7174pybind11_enable_warnings(pybind11_tests)
7275
7376if (EIGEN3_FOUND)
@@ -80,9 +83,11 @@ set(testdir ${PROJECT_SOURCE_DIR}/tests)
8083# Always write the output file directly into the 'tests' directory (even on MSVC)
8184if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY )
8285 set_target_properties (pybind11_tests PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${testdir} )
86+ set_target_properties (pybind11_test_broken_import PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${testdir} )
8387 foreach (config ${CMAKE_CONFIGURATION_TYPES} )
8488 string (TOUPPER ${config} config)
8589 set_target_properties (pybind11_tests PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config} ${testdir} )
90+ set_target_properties (pybind11_test_broken_import PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config} ${testdir} )
8691 endforeach ()
8792endif ()
8893
@@ -97,8 +102,8 @@ if(NOT PYBIND11_PYTEST_FOUND)
97102endif ()
98103
99104# A single command to compile and run the tests
100- add_custom_target (pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest -rws ${PYBIND11_PYTEST_FILES}
101- DEPENDS pybind11_tests WORKING_DIRECTORY ${testdir} )
105+ add_custom_target (pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest -rws ${PYBIND11_PYTEST_FILES} test_incompatible_holder.py
106+ DEPENDS pybind11_tests pybind11_test_broken_import WORKING_DIRECTORY ${testdir} )
102107
103108if (PYBIND11_TEST_OVERRIDE)
104109 add_custom_command (TARGET pytest POST_BUILD
0 commit comments