You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(cuda.core): run the host_callback_cfunc node attribute tests and drop empty - #3647
test_node_attrs and test_node_attrs_preserved_by_nodes skipped any node spec with no expected attributes, so [empty] and [host_callback_cfunc] never ran anywhere.
_build_host_callback_cfunc_node
- return node, {}+ return node, {"callback": lambda v: v is None} # ctypes callbacks have no Python callable
test_node_attrs / test_node_attrs_preserved_by_nodes
- (node_spec) if not expected_attrs: pytest.skip(...)+ (node_spec_with_attrs) assert expected_attrs # every spec except `empty`
host_callback_cfunc now checks the documented contract of HostCallbackNode.callback: "The Python callable, or None for ctypes function pointer callbacks". test_graph_node_update.py's ctypes case relies on the same behavior.
empty has no type-specific attributes, so the two tests no longer collect it. node_spec_with_attrs shares its build code with node_spec.
The skip becomes an assertion, so a future spec with no expectations fails instead of silently skipping.
The "not currently run in any CI job" markers are removed.
Evidence
CI coverage: on main, the sibling [host_callback] spec (a Python callback, the same HostCallbackNode type) passes both tests in all 65 CI configurations that run this file. [host_callback_cfunc] builds the same node type with no extra requirements, so it should now run in those same 65 configurations. [empty] is no longer collected for these two tests.
Locally: both tests collect 36 cases (no [empty]), and all pass with no skips. The whole file passes.
Confirming in CI: in this PR's CI run, every cuda.core job should report test_node_attrs[host_callback_cfunc] and test_node_attrs_preserved_by_nodes[host_callback_cfunc] PASSED, where main reports them SKIPPED. For example:
gh run view <CI run id> --repo NVIDIA/cuda-python --log | grep -F "[host_callback_cfunc]" | grep -E "test_node_attrs"
Merge Danger
Door: two-way. Test-only change.
Blast Radius: two tests in cuda_core/tests/graph/test_graph_definition.py. Every case that ran before still runs.
Reviewers: please feel free to push commits directly to this PR to improve it.
… drop empty
test_node_attrs and test_node_attrs_preserved_by_nodes skipped any node
spec with no expected attributes, so [empty] and [host_callback_cfunc]
never ran.
- Give host_callback_cfunc a real expectation: a ctypes function pointer
callback has no Python callable, so HostCallbackNode.callback is None.
- Run the two tests over node_spec_with_attrs, which leaves out the empty
node, and assert that every spec has expected attributes instead of
skipping.
Remove the "not currently run in any CI job" markers.
ClosesNVIDIA#3570.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Updated graph-definition test coverage for reconstructed callback attributes and node specifications.
Attribute checks now use cases with non-empty attributes, while callback expectations reflect a None attribute value.
The graph-definition tests now expect a None callback attribute for ctypes host-callback nodes. A filtered fixture excludes empty-node specs from attribute tests, which now require nonempty expected attributes.
Changes: Graph node attribute tests
Layer / File(s)
Summary
Node specs and attribute checks cuda_core/tests/graph/test_graph_definition.py
The ctypes callback node spec expects a None callback. A new fixture excludes the empty-node spec, and both attribute tests use that fixture and require nonempty expected attributes.
Assessment against linked issues
Objective
Addressed
Explanation
[#3570] Exclude the empty-node spec from attribute tests and check the ctypes callback attribute in both tests.
✅
Suggested reviewers:andy-jost, jpascucci-nv
Change: Other · Severity of issue fixed: Low
Merge Risk: Low · up to 5e43d
This test-only change adds the ctypes callback expectation and removes the empty-node case from the attribute tests. It does not add the automated CI check that the linked issue requests. Merging is low risk, but owners should be aware that no check guards against these cases being skipped later.
Security architecture risk: Minimal · up to 5e43d
The PR changes which graph-node test cases run and what they assert. It does not change how applications create, inspect, or execute CUDA graphs.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 1c9ed66 and 5e43db6.
Files selected for processing: 1
cuda_core/tests/graph/test_graph_definition.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 8 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Heavy lift
Add an automated check for the host_callback_cfunc cases.
Issue #3570 requires a way to confirm automatically that both [host_callback_cfunc] attribute cases run in at least one CI configuration. This PR removes the "not run in CI" markers but adds no such check. The core job runs pytest ... tests/ without a selection filter (ci/tools/run-tests:190), so the cases run today. Nothing in the change, however, fails CI if either case is later deselected or skipped. The requirement stays unmet until a CI-side check exists.
Add a CI check that fails the run when either host_callback_cfunc case is missing from the results or is skipped. The check's form is open. Options include inspecting the JUnit output the core job already writes, or a test-level assertion on collection. Choose one and document the choice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cuda.coreEverything related to the cuda.core moduletestImprovements or additions to tests
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3570. Part of #2077.
Summary
test_node_attrsandtest_node_attrs_preserved_by_nodesskipped any node spec with no expected attributes, so[empty]and[host_callback_cfunc]never ran anywhere.host_callback_cfuncnow checks the documented contract ofHostCallbackNode.callback: "The Python callable, or None for ctypes function pointer callbacks".test_graph_node_update.py's ctypes case relies on the same behavior.emptyhas no type-specific attributes, so the two tests no longer collect it.node_spec_with_attrsshares its build code withnode_spec.Evidence
CI coverage: on
main, the sibling[host_callback]spec (a Python callback, the sameHostCallbackNodetype) passes both tests in all 65 CI configurations that run this file.[host_callback_cfunc]builds the same node type with no extra requirements, so it should now run in those same 65 configurations.[empty]is no longer collected for these two tests.Locally: both tests collect 36 cases (no
[empty]), and all pass with no skips. The whole file passes.Confirming in CI: in this PR's CI run, every cuda.core job should report
test_node_attrs[host_callback_cfunc]andtest_node_attrs_preserved_by_nodes[host_callback_cfunc]PASSED, wheremainreports them SKIPPED. For example:Merge Danger
Door: two-way. Test-only change.
Blast Radius: two tests in
cuda_core/tests/graph/test_graph_definition.py. Every case that ran before still runs.Reviewers: please feel free to push commits directly to this PR to improve it.
🤖 Generated with Claude Code