From 96bd4b3fcfe73377c4960d937b37aefb743d3640 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 30 Nov 2026 09:55:59 -0500 Subject: [PATCH] test(cuda.core): don't collect host-callback-ctypes for the wrong-type update test test_definition_node_update_rejects_wrong_type skipped every case whose invalid_argument_update is None. Only the ctypes host-callback case has none, so test_definition_node_update_rejects_wrong_type[host-callback-ctypes] never ran. A ctypes callback's update takes any callable; its prototype check is already covered by test_host_callback_ctypes_update_rejects_incompatible_signature. Run this test over definition_update_case_with_typed_argument, which leaves out the ctypes case and shares setup with definition_update_case, and assert instead of skipping. Remove the "not currently run in any CI job" marker. Closes #3571. Co-Authored-By: Claude Opus 5.5 --- .../tests/graph/test_graph_node_update.py | 61 +++++++++++-------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/cuda_core/tests/graph/test_graph_node_update.py b/cuda_core/tests/graph/test_graph_node_update.py index cfb05a0481b2..71590a5d1eeb 100644 --- a/cuda_core/tests/graph/test_graph_node_update.py +++ b/cuda_core/tests/graph/test_graph_node_update.py @@ -584,32 +584,46 @@ def assert_exec_uses(graph, expected): ) -@pytest.fixture( - params=[ - pytest.param(_event_record_case, id="event-record"), - pytest.param(_event_wait_case, id="event-wait"), - pytest.param(_host_callback_case, id="host-callback-python"), - pytest.param(_host_callback_ctypes_case, id="host-callback-ctypes"), - pytest.param(_memset_value_case, id="memset-value"), - pytest.param(_memset_destination_case, id="memset-destination"), - pytest.param(_memcpy_size_case, id="memcpy-size"), - pytest.param(_memcpy_source_case, id="memcpy-source"), - pytest.param(_memcpy_destination_case, id="memcpy-destination"), - pytest.param(_kernel_config_case, id="kernel-config"), - pytest.param(_kernel_args_case, id="kernel-args"), - pytest.param(_kernel_function_case, id="kernel-function"), - pytest.param(_child_graph_case, id="child-graph"), - ] -) -def definition_update_case(request, init_cuda): +_DEFINITION_UPDATE_CASES = [ + pytest.param(_event_record_case, id="event-record"), + pytest.param(_event_wait_case, id="event-wait"), + pytest.param(_host_callback_case, id="host-callback-python"), + pytest.param(_host_callback_ctypes_case, id="host-callback-ctypes"), + pytest.param(_memset_value_case, id="memset-value"), + pytest.param(_memset_destination_case, id="memset-destination"), + pytest.param(_memcpy_size_case, id="memcpy-size"), + pytest.param(_memcpy_source_case, id="memcpy-source"), + pytest.param(_memcpy_destination_case, id="memcpy-destination"), + pytest.param(_kernel_config_case, id="kernel-config"), + pytest.param(_kernel_args_case, id="kernel-args"), + pytest.param(_kernel_function_case, id="kernel-function"), + pytest.param(_child_graph_case, id="child-graph"), +] + + +def _definition_update_case_factory(factory): if driver_version() < (12, 2, 0): pytest.skip("individual graph node updates require CUDA 12.2+") - factory = request.param # pytest-run-parallel shares this fixture object across workers. Build the # case at call time on Device() so each worker gets its own graph/node. return lambda: factory(Device()) +@pytest.fixture(params=_DEFINITION_UPDATE_CASES) +def definition_update_case(request, init_cuda): + return _definition_update_case_factory(request.param) + + +@pytest.fixture(params=[param for param in _DEFINITION_UPDATE_CASES if param.id != "host-callback-ctypes"]) +def definition_update_case_with_typed_argument(request, init_cuda): + """Like ``definition_update_case``, for cases whose update takes a typed argument. + + A ctypes host callback's ``update`` takes any callable; its prototype check is + covered by ``test_host_callback_ctypes_update_rejects_incompatible_signature``. + """ + return _definition_update_case_factory(request.param) + + @pytest.mark.agent_authored(model="gpt-5.6") def test_memcpy_update_rejects_unsupported_descriptor(init_cuda): if driver_version() < (12, 2, 0): @@ -993,15 +1007,12 @@ def test_failed_definition_node_update_preserves_state( case.assert_exec_uses(graph, case.original) -# For the host-callback-ctypes parameter case: -# This test is not currently run in any CI job @pytest.mark.agent_authored(model="gpt-5.6") def test_definition_node_update_rejects_wrong_type( - definition_update_case, + definition_update_case_with_typed_argument, ): - case = definition_update_case() - if case.invalid_argument_update is None: - pytest.skip("update method has no typed positional argument") + case = definition_update_case_with_typed_argument() + assert case.invalid_argument_update is not None with pytest.raises(TypeError): case.invalid_argument_update()