Skip to content

Commit

Permalink
pytest.skip num_violations == 0 only #ifdef __NO_INLINE__ (irre…
Browse files Browse the repository at this point in the history
…spective of the compiler)
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Jul 20, 2022
1 parent f930544 commit 87adbbf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 7 additions & 0 deletions tests/test_type_caster_odr_guard_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,11 @@ TEST_SUBMODULE(type_caster_odr_guard_1, m) {

// See comment near the bottom of test_type_caster_odr_guard_2.cpp.
m.def("pass_vector_type_mrc", mrc_ns::pass_vector_type_mrc);

m.attr("ifdef__NO_INLINE__") =
#ifdef __NO_INLINE__
true;
#else
false;
#endif
}
6 changes: 2 additions & 4 deletions tests/test_type_caster_odr_guard_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ 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 and (
pybind11_tests.compiler_info == "9.4.0" # Debug build known to not work.
):
elif num_violations == 0 and m.ifdef__NO_INLINE__:
pytest.skip(
"UNEXPECTED: type_caster_odr_violation_detected_count() == 0 (%s %s)"
"type_caster_odr_violation_detected_count() == 0: %s, %s, __NO_INLINE__"
% (pybind11_tests.compiler_info, pybind11_tests.cpp_std)
)
else:
Expand Down

0 comments on commit 87adbbf

Please sign in to comment.