Skip to content

Commit 718dde6

Browse files
committed
Moved tests into one file
1 parent 55eb389 commit 718dde6

File tree

2 files changed

+43
-44
lines changed

2 files changed

+43
-44
lines changed

tests/test_feature_flags.py

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
import sentry_sdk
7-
from sentry_sdk.feature_flags import add_feature_flag
7+
from sentry_sdk.feature_flags import add_feature_flag, FlagBuffer
88

99

1010
def test_featureflags_integration(sentry_init, capture_events, uninstall_integration):
@@ -125,3 +125,45 @@ async def runner():
125125
{"flag": "world", "result": False},
126126
]
127127
}
128+
129+
130+
def test_flag_tracking():
131+
"""Assert the ring buffer works."""
132+
buffer = FlagBuffer(capacity=3)
133+
buffer.set("a", True)
134+
flags = buffer.get()
135+
assert len(flags) == 1
136+
assert flags == [{"flag": "a", "result": True}]
137+
138+
buffer.set("b", True)
139+
flags = buffer.get()
140+
assert len(flags) == 2
141+
assert flags == [{"flag": "a", "result": True}, {"flag": "b", "result": True}]
142+
143+
buffer.set("c", True)
144+
flags = buffer.get()
145+
assert len(flags) == 3
146+
assert flags == [
147+
{"flag": "a", "result": True},
148+
{"flag": "b", "result": True},
149+
{"flag": "c", "result": True},
150+
]
151+
152+
buffer.set("d", False)
153+
flags = buffer.get()
154+
assert len(flags) == 3
155+
assert flags == [
156+
{"flag": "b", "result": True},
157+
{"flag": "c", "result": True},
158+
{"flag": "d", "result": False},
159+
]
160+
161+
buffer.set("e", False)
162+
buffer.set("f", False)
163+
flags = buffer.get()
164+
assert len(flags) == 3
165+
assert flags == [
166+
{"flag": "d", "result": False},
167+
{"flag": "e", "result": False},
168+
{"flag": "f", "result": False},
169+
]

tests/test_flag_utils.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)