Skip to content

Commit 37d43c9

Browse files
chrisguidryclaude
andcommitted
Fix test to handle non-deterministic task execution order
Tasks don't execute in a guaranteed order with parallel workers, so changed the test to use a dictionary lookup by task name instead of assuming array order. This fixes the flaky test failure in CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a5c18c0 commit 37d43c9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/test_dependencies.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,14 @@ async def second_task(b: str):
482482

483483
# Verify we captured both executions
484484
assert len(executions_seen) == 2
485-
assert executions_seen[0][0] == "first"
486-
assert executions_seen[1][0] == "second"
485+
486+
# Find first and second executions (order may vary)
487+
executions_by_name = {name: exec for name, exec in executions_seen}
488+
assert set(executions_by_name.keys()) == {"first", "second"}
487489

488490
# Verify the executions are different and have correct kwargs
489-
first_execution = executions_seen[0][1]
490-
second_execution = executions_seen[1][1]
491+
first_execution = executions_by_name["first"]
492+
second_execution = executions_by_name["second"]
491493
assert first_execution is not second_execution
492494
assert first_execution.kwargs["a"] == "first"
493495
assert second_execution.kwargs["b"] == "second"

0 commit comments

Comments
 (0)