Skip to content

Commit 87adbbf

Browse files
committed
pytest.skip num_violations == 0 only #ifdef __NO_INLINE__ (irrespective of the compiler)
1 parent f930544 commit 87adbbf

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tests/test_type_caster_odr_guard_1.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,11 @@ TEST_SUBMODULE(type_caster_odr_guard_1, m) {
7575

7676
// See comment near the bottom of test_type_caster_odr_guard_2.cpp.
7777
m.def("pass_vector_type_mrc", mrc_ns::pass_vector_type_mrc);
78+
79+
m.attr("ifdef__NO_INLINE__") =
80+
#ifdef __NO_INLINE__
81+
true;
82+
#else
83+
false;
84+
#endif
7885
}

tests/test_type_caster_odr_guard_1.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ def test_type_caster_odr_violation_detected_counter():
3636
num_violations = m.type_caster_odr_violation_detected_count()
3737
if num_violations is None:
3838
pytest.skip("type_caster_odr_violation_detected_count() is None")
39-
elif num_violations == 0 and (
40-
pybind11_tests.compiler_info == "9.4.0" # Debug build known to not work.
41-
):
39+
elif num_violations == 0 and m.ifdef__NO_INLINE__:
4240
pytest.skip(
43-
"UNEXPECTED: type_caster_odr_violation_detected_count() == 0 (%s %s)"
41+
"type_caster_odr_violation_detected_count() == 0: %s, %s, __NO_INLINE__"
4442
% (pybind11_tests.compiler_info, pybind11_tests.cpp_std)
4543
)
4644
else:

0 commit comments

Comments
 (0)