From 491c2c79831d99a4f24a69f02cc36642c73d421c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 22 Jun 2022 17:41:11 -0700 Subject: [PATCH] compiler_info MSVC fix. num_violations == 0 condition. --- tests/pybind11_tests.cpp | 2 +- tests/test_type_caster_odr_guard_1.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/pybind11_tests.cpp b/tests/pybind11_tests.cpp index 870303d8b..6933dd328 100644 --- a/tests/pybind11_tests.cpp +++ b/tests/pybind11_tests.cpp @@ -79,7 +79,7 @@ PYBIND11_MODULE(pybind11_tests, m) { m.doc() = "pybind11 test module"; #if defined(_MSC_FULL_VER) - m.attr("compiler_info") = "MSVC " _MSC_FULL_VER; + m.attr("compiler_info") = "MSVC " PYBIND11_TOSTRING(_MSC_FULL_VER); #elif defined(__VERSION__) m.attr("compiler_info") = __VERSION__; #else diff --git a/tests/test_type_caster_odr_guard_1.py b/tests/test_type_caster_odr_guard_1.py index 20a7b8035..527412821 100644 --- a/tests/test_type_caster_odr_guard_1.py +++ b/tests/test_type_caster_odr_guard_1.py @@ -36,7 +36,13 @@ 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 num_violations == 0: + elif num_violations == 0 and ( + # 3.9-dbg (deadsnakes) Valgrind x64: + # This failure is unexplained and the condition here is not completely specific, + # but deemed a good-enough workaround. + pybind11_tests.compiler_info == "9.4.0" + and pybind11_tests.cpp_std == "C++17" + ): pytest.skip( "UNEXPECTED: type_caster_odr_violation_detected_count() == 0 (%s %s)" % (pybind11_tests.compiler_info, pybind11_tests.cpp_std)