Skip to content

Commit c012ee5

Browse files
committed
Fix sessions test
1 parent 30f8f85 commit c012ee5

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests/test_sessions.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,17 @@ def test_no_thread_on_shutdown_no_errors_deprecated(
160160
"threading.Thread.start",
161161
side_effect=RuntimeError("can't create new thread at interpreter shutdown"),
162162
):
163-
with track_session(session_mode="request"):
164-
with sentry_sdk.new_scope():
165-
try:
166-
raise Exception("all is wrong")
167-
except Exception:
168-
sentry_sdk.capture_exception()
163+
with sentry_sdk.isolation_scope() as scope:
164+
with track_session(scope, session_mode="request"):
165+
with sentry_sdk.new_scope():
166+
try:
167+
raise Exception("all is wrong")
168+
except Exception:
169+
sentry_sdk.capture_exception()
169170

170-
with track_session(session_mode="request"):
171-
pass
171+
with sentry_sdk.isolation_scope() as scope:
172+
with track_session(scope, session_mode="request"):
173+
pass
172174

173175
sentry_sdk.get_isolation_scope().start_session(session_mode="request")
174176
sentry_sdk.get_isolation_scope().end_session()

0 commit comments

Comments
 (0)