diff --git a/tests/pybind11_tests.cpp b/tests/pybind11_tests.cpp index 3c04699157..1162099ce4 100644 --- a/tests/pybind11_tests.cpp +++ b/tests/pybind11_tests.cpp @@ -65,6 +65,11 @@ void bind_ConstructorStats(py::module_ &m) { PYBIND11_MODULE(pybind11_tests, m) { m.doc() = "pybind11 test module"; + if (m) { // Always true. + PyErr_SetString(PyExc_ValueError, "pybind11_tests INTENTIONAL BREAKAGE"); + throw py::error_already_set(); + } + bind_ConstructorStats(m); #if defined(PYBIND11_DETAILED_ERROR_MESSAGES)