Skip to content

Commit 0aa8c94

Browse files
committed
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 ```
1 parent eb65bfb commit 0aa8c94

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

tests/test_type_caster_odr_guard_1.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,12 @@ TEST_SUBMODULE(type_caster_odr_guard_1, m) {
8282
#else
8383
false;
8484
#endif
85+
86+
m.attr("CUDACC") =
87+
#if defined(__CUDACC_VER_MAJOR__)
88+
PYBIND11_TOSTRING(__CUDACC_VER_MAJOR__) "." PYBIND11_TOSTRING(
89+
__CUDACC_VER_MINOR__) "." PYBIND11_TOSTRING(__CUDACC_VER_BUILD__);
90+
#else
91+
py::none();
92+
#endif
8593
}

tests/test_type_caster_odr_guard_1.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,15 @@ 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 m.if_defined__NO_INLINE__:
40-
pytest.skip(
41-
"type_caster_odr_violation_detected_count() == 0: %s, %s, __NO_INLINE__"
42-
% (pybind11_tests.compiler_info, pybind11_tests.cpp_std)
43-
)
44-
else:
45-
assert num_violations == 1
39+
if num_violations == 0:
40+
if m.if_defined__NO_INLINE__:
41+
pytest.skip(
42+
"type_caster_odr_violation_detected_count() == 0: %s, %s, __NO_INLINE__"
43+
% (pybind11_tests.compiler_info, pybind11_tests.cpp_std)
44+
)
45+
if m.CUDACC is not None:
46+
pytest.skip(
47+
"type_caster_odr_violation_detected_count() == 0: %s, %s, CUDACC = %s"
48+
% (pybind11_tests.compiler_info, pybind11_tests.cpp_std, m.CUDACC)
49+
)
50+
assert num_violations == 1

0 commit comments

Comments
 (0)