Skip to content

Commit c8e93af

Browse files
test(sessions): Replace push_scope (#3354)
All usages of `sentry_sdk.push_scope` in `test_sessions.py` can be replaced with `new_scope`. Closes: #3345
1 parent 20ed5b7 commit c8e93af

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/test_sessions.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ def test_aggregates(sentry_init, capture_envelopes):
5151
envelopes = capture_envelopes()
5252

5353
with auto_session_tracking(session_mode="request"):
54-
with sentry_sdk.push_scope():
54+
with sentry_sdk.new_scope() as scope:
5555
try:
56-
scope = sentry_sdk.Scope.get_current_scope()
5756
scope.set_user({"id": "42"})
5857
raise Exception("all is wrong")
5958
except Exception:
@@ -92,7 +91,7 @@ def test_aggregates_explicitly_disabled_session_tracking_request_mode(
9291
envelopes = capture_envelopes()
9392

9493
with auto_session_tracking(session_mode="request"):
95-
with sentry_sdk.push_scope():
94+
with sentry_sdk.new_scope():
9695
try:
9796
raise Exception("all is wrong")
9897
except Exception:
@@ -127,7 +126,7 @@ def test_no_thread_on_shutdown_no_errors(sentry_init):
127126
side_effect=RuntimeError("can't create new thread at interpreter shutdown"),
128127
):
129128
with auto_session_tracking(session_mode="request"):
130-
with sentry_sdk.push_scope():
129+
with sentry_sdk.new_scope():
131130
try:
132131
raise Exception("all is wrong")
133132
except Exception:

0 commit comments

Comments
 (0)