Skip to content

Commit

Permalink
test(sessions): Replace push_scope
Browse files Browse the repository at this point in the history
All usages of `sentry_sdk.push_scope` in `test_sessions.py` can be
replaced with `new_scope`.

Closes: #3345
  • Loading branch information
szokeasaurusrex committed Jul 26, 2024
1 parent 0b60ace commit d09b113
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ def test_aggregates(sentry_init, capture_envelopes):
envelopes = capture_envelopes()

with auto_session_tracking(session_mode="request"):
with sentry_sdk.push_scope():
with sentry_sdk.new_scope() as scope:
try:
scope = sentry_sdk.Scope.get_current_scope()
scope.set_user({"id": "42"})
raise Exception("all is wrong")
except Exception:
Expand Down Expand Up @@ -92,7 +91,7 @@ def test_aggregates_explicitly_disabled_session_tracking_request_mode(
envelopes = capture_envelopes()

with auto_session_tracking(session_mode="request"):
with sentry_sdk.push_scope():
with sentry_sdk.new_scope():
try:
raise Exception("all is wrong")
except Exception:
Expand Down Expand Up @@ -127,7 +126,7 @@ def test_no_thread_on_shutdown_no_errors(sentry_init):
side_effect=RuntimeError("can't create new thread at interpreter shutdown"),
):
with auto_session_tracking(session_mode="request"):
with sentry_sdk.push_scope():
with sentry_sdk.new_scope():
try:
raise Exception("all is wrong")
except Exception:
Expand Down

0 comments on commit d09b113

Please sign in to comment.