Skip to content

Commit 631ad1b

Browse files
committed
fixed assert
1 parent 63267f5 commit 631ad1b

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

tests/test_feature_flags.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ async def test_featureflags_integration_spans_async(sentry_init, capture_events)
4747
except ValueError as e:
4848
sentry_sdk.capture_exception(e)
4949

50-
assert events[0]["contexts"]["flags"] == {
51-
"values": [
52-
{"flag": "hello", "result": False},
53-
]
54-
}
50+
found = False
51+
for event in events:
52+
if "exception" in event.keys():
53+
assert event["contexts"]["flags"] == {
54+
"values": [
55+
{"flag": "hello", "result": False},
56+
]
57+
}
58+
found = True
59+
60+
assert found, "No event with exception found"
5561

5662

5763
def test_featureflags_integration_spans_sync(sentry_init, capture_events):
@@ -69,11 +75,17 @@ def test_featureflags_integration_spans_sync(sentry_init, capture_events):
6975
except ValueError as e:
7076
sentry_sdk.capture_exception(e)
7177

72-
assert events[0]["contexts"]["flags"] == {
73-
"values": [
74-
{"flag": "hello", "result": False},
75-
]
76-
}
78+
found = False
79+
for event in events:
80+
if "exception" in event.keys():
81+
assert event["contexts"]["flags"] == {
82+
"values": [
83+
{"flag": "hello", "result": False},
84+
]
85+
}
86+
found = True
87+
88+
assert found, "No event with exception found"
7789

7890

7991
def test_featureflags_integration_threaded(

0 commit comments

Comments
 (0)