Skip to content

Commit b76dd8d

Browse files
chrisguidryclaude
andcommitted
Fix partial branch coverage in test_replace_skips_stale_stream_message
Replace for/if/break loop with next() to avoid untaken branches that some Python versions flag as partial coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0fc6f6a commit b76dd8d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

tests/test_perpetual_race.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,7 @@ async def tracked_task(
293293
# Grab the gen=1 message before replace() deletes it
294294
async with docket.redis() as redis:
295295
messages = await redis.xrange(docket.stream_key, count=10)
296-
stale_message = None
297-
for _, msg in messages:
298-
if msg[b"key"] == b"replace-race":
299-
stale_message = msg
300-
break
301-
assert stale_message is not None
296+
stale_message = next(msg for _, msg in messages if msg[b"key"] == b"replace-race")
302297

303298
# replace() deletes gen=1 from the stream and adds gen=2
304299
await docket.replace(tracked_task, datetime.now(timezone.utc), "replace-race")()

0 commit comments

Comments
 (0)