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 6, 2024
1 parent dd15d32 commit 7674bf2
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 7674bf2

Please sign in to comment.