Skip to content

Commit 736393d

Browse files
Andy-Jostclaude
andcommitted
test(cuda.core): compare the UUID with its original after a rejected register()
A rejected registration that cleared the UUID to None would have passed the old check (uuid != other). CodeRabbit's suggestion. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 620afec commit 736393d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎cuda_core/tests/memory_ipc/test_errors.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,17 @@ def test_register_rejects_mismatched_uuid(ipc_memory_resource):
105105
assert mr.is_ipc_enabled
106106

107107
# The resource must already carry its own UUID (assigned on creation).
108-
assert mr.uuid is not None
108+
original = mr.uuid
109+
assert original is not None
109110
other = uuid.uuid4()
110111
while other == mr.uuid:
111112
other = uuid.uuid4()
112113

113114
with pytest.raises(ValueError, match="already has UUID"):
114115
mr.register(other)
115116

116-
# A rejected registration must not rewrite the resource's own UUID.
117-
assert mr.uuid != other
117+
# A rejected registration must leave the resource's own UUID unchanged.
118+
assert mr.uuid == original
118119

119120
# Registering under the resource's own UUID still succeeds.
120121
assert mr.register(mr.uuid) is mr

0 commit comments

Comments
 (0)