From 262998b31728b39d838497176e1480366e6a183c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 22 Jun 2022 12:51:19 -0700 Subject: [PATCH] Report UNEXPECTED: test_type_caster_odr_guard_2.cpp prevailed (but do not fail). --- tests/test_type_caster_odr_guard_1.cpp | 2 +- tests/test_type_caster_odr_guard_1.py | 18 +++++++++++++++--- tests/test_type_caster_odr_guard_2.cpp | 2 +- tests/test_type_caster_odr_guard_2.py | 20 +++++++++++++++++--- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/tests/test_type_caster_odr_guard_1.cpp b/tests/test_type_caster_odr_guard_1.cpp index 25e8e1a6e..0029e3a54 100644 --- a/tests/test_type_caster_odr_guard_1.cpp +++ b/tests/test_type_caster_odr_guard_1.cpp @@ -43,7 +43,7 @@ struct type_caster : mrc_ns::minimal_real_caster {}; } // namespace detail } // namespace pybind11 -TEST_SUBMODULE(odr_guard_1, m) { +TEST_SUBMODULE(type_caster_odr_guard_1, m) { m.def("type_mrc_to_python", []() { return mrc_ns::type_mrc(101); }); m.def("type_mrc_from_python", [](const mrc_ns::type_mrc &obj) { return obj.value + 100; }); m.def("type_caster_odr_guard_registry_values", []() { diff --git a/tests/test_type_caster_odr_guard_1.py b/tests/test_type_caster_odr_guard_1.py index c95e1a827..ac26f982c 100644 --- a/tests/test_type_caster_odr_guard_1.py +++ b/tests/test_type_caster_odr_guard_1.py @@ -1,14 +1,26 @@ import pytest -import pybind11_tests.odr_guard_1 as m +import pybind11_tests.type_caster_odr_guard_1 as m def test_type_mrc_to_python(): - assert m.type_mrc_to_python() == 1111 + val = m.type_mrc_to_python() + if val == 101 + 2020: + pytest.skip( + "UNEXPECTED: test_type_caster_odr_guard_2.cpp prevailed (to_python)." + ) + else: + assert val == 101 + 1010 def test_type_mrc_from_python(): - assert m.type_mrc_from_python("ignored") == 111 + val = m.type_mrc_from_python("ignored") + if val == 100 + 22: + pytest.skip( + "UNEXPECTED: test_type_caster_odr_guard_2.cpp prevailed (from_python)." + ) + else: + assert val == 100 + 11 def test_type_caster_odr_registry_values(): diff --git a/tests/test_type_caster_odr_guard_2.cpp b/tests/test_type_caster_odr_guard_2.cpp index b9400cc5d..126466b7d 100644 --- a/tests/test_type_caster_odr_guard_2.cpp +++ b/tests/test_type_caster_odr_guard_2.cpp @@ -45,7 +45,7 @@ struct type_caster : mrc_ns::minimal_real_caster {}; } // namespace detail } // namespace pybind11 -TEST_SUBMODULE(odr_guard_2, m) { +TEST_SUBMODULE(type_caster_odr_guard_2, m) { m.def("type_mrc_to_python", []() { return mrc_ns::type_mrc(202); }); m.def("type_mrc_from_python", [](const mrc_ns::type_mrc &obj) { return obj.value + 200; }); } diff --git a/tests/test_type_caster_odr_guard_2.py b/tests/test_type_caster_odr_guard_2.py index a241d03b7..b4f5ef6c4 100644 --- a/tests/test_type_caster_odr_guard_2.py +++ b/tests/test_type_caster_odr_guard_2.py @@ -1,9 +1,23 @@ -import pybind11_tests.odr_guard_2 as m +import pytest + +import pybind11_tests.type_caster_odr_guard_2 as m def test_type_mrc_to_python(): - assert m.type_mrc_to_python() in (202 + 2020, 202 + 1010) + val = m.type_mrc_to_python() + if val == 202 + 2020: + pytest.skip( + "UNEXPECTED: test_type_caster_odr_guard_2.cpp prevailed (to_python)." + ) + else: + assert val == 202 + 1010 def test_type_mrc_from_python(): - assert m.type_mrc_from_python("ignored") in (200 + 22, 200 + 11) + val = m.type_mrc_from_python("ignored") + if val == 200 + 22: + pytest.skip( + "UNEXPECTED: test_type_caster_odr_guard_2.cpp prevailed (from_python)." + ) + else: + assert val == 200 + 11