Report UNEXPECTED: test_type_caster_odr_guard_2.cpp prevailed (but do not fail).

This commit is contained in:
Ralf W. Grosse-Kunstleve 2022-06-22 12:51:19 -07:00
parent 1263ce9ee2
commit 262998b317
4 changed files with 34 additions and 8 deletions

View File

@ -43,7 +43,7 @@ struct type_caster<mrc_ns::type_mrc> : mrc_ns::minimal_real_caster {};
} // namespace detail } // namespace detail
} // namespace pybind11 } // 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_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_mrc_from_python", [](const mrc_ns::type_mrc &obj) { return obj.value + 100; });
m.def("type_caster_odr_guard_registry_values", []() { m.def("type_caster_odr_guard_registry_values", []() {

View File

@ -1,14 +1,26 @@
import pytest 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(): 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(): 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(): def test_type_caster_odr_registry_values():

View File

@ -45,7 +45,7 @@ struct type_caster<mrc_ns::type_mrc> : mrc_ns::minimal_real_caster {};
} // namespace detail } // namespace detail
} // namespace pybind11 } // 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_to_python", []() { return mrc_ns::type_mrc(202); });
m.def("type_mrc_from_python", [](const mrc_ns::type_mrc &obj) { return obj.value + 200; }); m.def("type_mrc_from_python", [](const mrc_ns::type_mrc &obj) { return obj.value + 200; });
} }

View File

@ -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(): 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(): 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