Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion testcases/common/trace_assert.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,22 @@ def assert_traces(traces_file: str, expected_file: str) -> None:
print(f"Loaded {len(traces)} traces from {traces_file}")
print(f"Checking {len(expected_spans)} expected spans...")
missing_spans = []
# Track which spans have already been matched to prevent double-matching
used_span_indices: set[int] = set()
for expected in expected_spans:
# Find a matching span
found = False
name = expected['name']
# Handle both string and list of names
name_str = name if isinstance(name, str) else f"[{' | '.join(name)}]"

for span in traces:
for i, span in enumerate(traces):
# Skip spans that have already been matched
if i in used_span_indices:
continue
if matches_expected(span, expected):
found = True
used_span_indices.add(i)
print(f"✓ Found span: {name_str}")
break
if not found:
Expand Down