Report PYBIND11_INTERNALS_ID & C++ Version from pytest_configure()

This commit is contained in:
Ralf W. Grosse-Kunstleve 2022-06-21 17:59:30 -07:00
parent cfd98a7de2
commit 502f3cb969
2 changed files with 10 additions and 1 deletions

View File

@ -13,7 +13,7 @@ import textwrap
import pytest
# Early diagnostic for failed imports
import pybind11_tests # noqa: F401
import pybind11_tests
_long_marker = re.compile(r"([0-9])L")
_hexadecimal = re.compile(r"0x[0-9a-fA-F]+")
@ -196,5 +196,11 @@ def gc_collect():
def pytest_configure():
print(
"PYBIND11_INTERNALS_ID & C++ Version:",
pybind11_tests.PYBIND11_INTERNALS_ID,
pybind11_tests.cpp_version_in_use,
flush=True,
)
pytest.suppress = suppress
pytest.gc_collect = gc_collect

View File

@ -65,6 +65,9 @@ void bind_ConstructorStats(py::module_ &m) {
PYBIND11_MODULE(pybind11_tests, m) {
m.doc() = "pybind11 test module";
m.attr("cpp_version_in_use") = py::detail::cpp_version_in_use();
m.attr("PYBIND11_INTERNALS_ID") = PYBIND11_INTERNALS_ID;
bind_ConstructorStats(m);
#if defined(PYBIND11_DETAILED_ERROR_MESSAGES)