Skip to content

Commit

Permalink
test(scope): Ensure last_event_id cleared
Browse files Browse the repository at this point in the history
Add test to ensure that clearing the isolation scope clears the `last_event_id`.
  • Loading branch information
szokeasaurusrex committed Jun 5, 2024
1 parent 7b10b4a commit c08ff62
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,3 +856,16 @@ def test_last_event_id_transaction(sentry_init):
pass

assert Scope.last_event_id() is None, "Transaction should not set last_event_id"


def test_last_event_id_cleared(sentry_init):
sentry_init(enable_tracing=True)

# Make sure last_event_id is set
sentry_sdk.capture_exception(Exception("test"))
assert Scope.last_event_id() is not None

# Clearing the isolation scope should clear the last_event_id
Scope.get_isolation_scope().clear()

assert Scope.last_event_id() is None, "last_event_id should be cleared"

0 comments on commit c08ff62

Please sign in to comment.