Add pytest.skip() for CUDACC

```
SKIPPED [1] ../../mounted_pybind11/tests/test_type_caster_odr_guard_1.py:46: type_caster_odr_violation_detected_count() == 0: 11.2.0, C++17, CUDACC = 11.7.99
```
This commit is contained in:
Ralf W. Grosse-Kunstleve 2022-10-08 19:36:51 -07:00
parent eb65bfb80e
commit 0aa8c94528
2 changed files with 20 additions and 7 deletions

View File

@ -82,4 +82,12 @@ TEST_SUBMODULE(type_caster_odr_guard_1, m) {
#else #else
false; false;
#endif #endif
m.attr("CUDACC") =
#if defined(__CUDACC_VER_MAJOR__)
PYBIND11_TOSTRING(__CUDACC_VER_MAJOR__) "." PYBIND11_TOSTRING(
__CUDACC_VER_MINOR__) "." PYBIND11_TOSTRING(__CUDACC_VER_BUILD__);
#else
py::none();
#endif
} }

View File

@ -36,10 +36,15 @@ def test_type_caster_odr_violation_detected_counter():
num_violations = m.type_caster_odr_violation_detected_count() num_violations = m.type_caster_odr_violation_detected_count()
if num_violations is None: if num_violations is None:
pytest.skip("type_caster_odr_violation_detected_count() is None") pytest.skip("type_caster_odr_violation_detected_count() is None")
elif num_violations == 0 and m.if_defined__NO_INLINE__: if num_violations == 0:
pytest.skip( if m.if_defined__NO_INLINE__:
"type_caster_odr_violation_detected_count() == 0: %s, %s, __NO_INLINE__" pytest.skip(
% (pybind11_tests.compiler_info, pybind11_tests.cpp_std) "type_caster_odr_violation_detected_count() == 0: %s, %s, __NO_INLINE__"
) % (pybind11_tests.compiler_info, pybind11_tests.cpp_std)
else: )
assert num_violations == 1 if m.CUDACC is not None:
pytest.skip(
"type_caster_odr_violation_detected_count() == 0: %s, %s, CUDACC = %s"
% (pybind11_tests.compiler_info, pybind11_tests.cpp_std, m.CUDACC)
)
assert num_violations == 1