Skip to content

Commit

Permalink
test(sessions): Replace push_scope (getsentry#3354)
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: getsentry#3345
  • Loading branch information
szokeasaurusrex authored and arjenzorgdoc committed Sep 30, 2024
1 parent 9a33cc4 commit c9615af
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 c9615af

Please sign in to comment.