diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 04dccd09d..af57b8c7d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -546,7 +546,6 @@ add_custom_target( --suppressions="${CMAKE_CURRENT_SOURCE_DIR}/valgrind-python.supp" --suppressions="${CMAKE_CURRENT_SOURCE_DIR}/valgrind-numpy-scipy.supp" --gen-suppressions=all - env PYBIND11_TESTING_WITH_VALGRIND=1 ${PYTHON_EXECUTABLE} -m pytest ${PYBIND11_ABS_PYTEST_FILES} DEPENDS ${test_targets} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" diff --git a/tests/conftest.py b/tests/conftest.py index 0bbd1bf83..647f7d2bd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -197,9 +197,10 @@ def gc_collect(): def pytest_configure(): print( - "PYBIND11_INTERNALS_ID & C++ Version:", + "C++ Info:", + pybind11_tests.compiler_info, + pybind11_tests.cpp_std, pybind11_tests.PYBIND11_INTERNALS_ID, - pybind11_tests.cpp_version_in_use, flush=True, ) pytest.suppress = suppress diff --git a/tests/pybind11_tests.cpp b/tests/pybind11_tests.cpp index 2f4a828f1..870303d8b 100644 --- a/tests/pybind11_tests.cpp +++ b/tests/pybind11_tests.cpp @@ -62,7 +62,7 @@ void bind_ConstructorStats(py::module_ &m) { }); } -const char *cpp_version_in_use() { +const char *cpp_std() { return #if defined(PYBIND11_CPP20) "C++20"; @@ -78,7 +78,14 @@ const char *cpp_version_in_use() { PYBIND11_MODULE(pybind11_tests, m) { m.doc() = "pybind11 test module"; - m.attr("cpp_version_in_use") = cpp_version_in_use(); +#if defined(_MSC_FULL_VER) + m.attr("compiler_info") = "MSVC " _MSC_FULL_VER; +#elif defined(__VERSION__) + m.attr("compiler_info") = __VERSION__; +#else + m.attr("compiler_info") = py::none(); +#endif + m.attr("cpp_std") = cpp_std(); m.attr("PYBIND11_INTERNALS_ID") = PYBIND11_INTERNALS_ID; bind_ConstructorStats(m); diff --git a/tests/test_type_caster_odr_guard_1.py b/tests/test_type_caster_odr_guard_1.py index 1415501e8..20a7b8035 100644 --- a/tests/test_type_caster_odr_guard_1.py +++ b/tests/test_type_caster_odr_guard_1.py @@ -1,7 +1,6 @@ -import os - import pytest +import pybind11_tests import pybind11_tests.type_caster_odr_guard_1 as m @@ -37,12 +36,10 @@ def test_type_caster_odr_violation_detected_counter(): num_violations = m.type_caster_odr_violation_detected_count() if num_violations is None: pytest.skip("type_caster_odr_violation_detected_count() is None") - elif ( - os.environ.get("PYBIND11_TESTING_WITH_VALGRIND") is not None - and num_violations == 0 - ): + elif num_violations == 0: pytest.skip( - "UNEXPECTED: type_caster_odr_violation_detected_count() == 0 (valgrind)" + "UNEXPECTED: type_caster_odr_violation_detected_count() == 0 (%s %s)" + % (pybind11_tests.compiler_info, pybind11_tests.cpp_std) ) else: assert num_violations == 1