Skip to content

Commit c4ebca8

Browse files
committed
fix: Add another testcase
1 parent cf7ce1c commit c4ebca8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_client.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,21 @@ def test_client_debug_option_disabled(with_client, sentry_init, caplog):
241241

242242
Hub.current._capture_internal_exception((ValueError, ValueError("OK"), None))
243243
assert "OK" not in caplog.text
244+
245+
246+
def test_scope_initialized_before_client(sentry_init, capture_events):
247+
"""
248+
This is a consequence of how configure_scope() works. We must
249+
make `configure_scope()` a noop if no client is configured. Even
250+
if the user later configures a client: We don't know that.
251+
"""
252+
with configure_scope() as scope:
253+
scope.set_tag("foo", 42)
254+
255+
sentry_init()
256+
257+
events = capture_events()
258+
capture_message("hi")
259+
event, = events
260+
261+
assert "tags" not in event

0 commit comments

Comments
 (0)