Skip to content

Commit 7674bf2

Browse files
test(scope): Ensure last_event_id cleared
Add test to ensure that clearing the isolation scope clears the `last_event_id`.
1 parent dd15d32 commit 7674bf2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_scope.py

+13
Original file line numberDiff line numberDiff line change
@@ -856,3 +856,16 @@ def test_last_event_id_transaction(sentry_init):
856856
pass
857857

858858
assert Scope.last_event_id() is None, "Transaction should not set last_event_id"
859+
860+
861+
def test_last_event_id_cleared(sentry_init):
862+
sentry_init(enable_tracing=True)
863+
864+
# Make sure last_event_id is set
865+
sentry_sdk.capture_exception(Exception("test"))
866+
assert Scope.last_event_id() is not None
867+
868+
# Clearing the isolation scope should clear the last_event_id
869+
Scope.get_isolation_scope().clear()
870+
871+
assert Scope.last_event_id() is None, "last_event_id should be cleared"

0 commit comments

Comments
 (0)