Skip to content

Un-swap the pass_by_address parametrize ids in test_kernelParams - #2559

Open
LeSingh1 wants to merge 1 commit into
NVIDIA:mainfrom
LeSingh1:kernelparams-parametrize-ids
Open

Un-swap the pass_by_address parametrize ids in test_kernelParams#2559
LeSingh1 wants to merge 1 commit into
NVIDIA:mainfrom
LeSingh1:kernelparams-parametrize-ids

Conversation

@LeSingh1

@LeSingh1 LeSingh1 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor
@pytest.mark.parametrize("pass_by_address", [False, True], ids=["by-address", "not-by-address"])
def test_kernelParams_buffer_protocol(pass_by_address, device):

pytest assigns ids to argvalues positionally, so pass_by_address=False gets the
id by-address and pass_by_address=True gets not-by-address. The test body is
unambiguous about which is which:

        ctypes.addressof(packagedParams) if pass_by_address else packagedParams,

True is the by-address case. Both ids name the opposite variant.

Confirmed with --collect-only on a minimal reproduction of the same decorator shape:

test_ids.py::test_main_shape[by-address]        <- pass_by_address=False   (wrong)
test_ids.py::test_main_shape[not-by-address]    <- pass_by_address=True    (wrong)
test_ids.py::test_fixed_shape[not-by-address]   <- pass_by_address=False   (right)
test_ids.py::test_fixed_shape[by-address]       <- pass_by_address=True    (right)

Impact is bounded — both branches still execute, so nothing goes untested — but every
failure report, -k selection, xfail entry and CI flake attribution names the wrong
variant. The neighbouring parametrize in the same file gets the mapping right
([False, True] with ids=["no-ctypes", "ctypes"]), which is what the fix matches.

No new test

The thing being corrected is pytest's id assignment, so a test asserting the ids would
just restate the decorator. pytest --collect-only -k kernelParams_buffer_protocol shows
the change directly, and the repro above pins the mechanism.

On the legacy_api copy

cuda_bindings/AGENTS.md says the legacy tests "should not be added to, only updated when
necessary to fix test failures". I applied the same one-line change there so the two files
do not disagree about what by-address means — nothing is added, and a wrong label is
arguably a failure-reporting defect. Say the word and I will drop that hunk and keep this
to the canonical file.

    @pytest.mark.parametrize("pass_by_address", [False, True], ids=["by-address", "not-by-address"])

pytest assigns ids to argvalues positionally, so pass_by_address=False gets
the id "by-address" and pass_by_address=True gets "not-by-address". The body
is unambiguous about which is which:

    ctypes.addressof(packagedParams) if pass_by_address else packagedParams

True is the by-address case, so both ids name the opposite variant. Every
failure report, -k selection and flake attribution for this test points at
the wrong one. The neighbouring parametrize in the same file gets the
mapping right (`[False, True]` with `ids=["no-ctypes", "ctypes"]`).

Both branches still execute, so no code path was going untested; this is a
labelling fix only, which is why there is no new test -- pytest's id
assignment is what is being corrected, and `--collect-only` shows it
directly.

Applied to the legacy_api copy as well, so the two files stay consistent.
@copy-pr-bot

copy-pr-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.bindings Everything related to the cuda.bindings module label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant