Skip to content

Commit 132a9c5

Browse files
test(basics): Stop using configure_scope (#3349)
Use `Scope.get_isolation_scope` instead. Ref #3344
1 parent cc0ee38 commit 132a9c5

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

tests/test_basics.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from sentry_sdk import (
1616
get_client,
1717
push_scope,
18-
configure_scope,
1918
capture_event,
2019
capture_exception,
2120
capture_message,
@@ -74,13 +73,11 @@ def test_processors(sentry_init, capture_events):
7473
sentry_init()
7574
events = capture_events()
7675

77-
with configure_scope() as scope:
78-
79-
def error_processor(event, exc_info):
80-
event["exception"]["values"][0]["value"] += " whatever"
81-
return event
76+
def error_processor(event, exc_info):
77+
event["exception"]["values"][0]["value"] += " whatever"
78+
return event
8279

83-
scope.add_error_processor(error_processor, ValueError)
80+
Scope.get_isolation_scope().add_error_processor(error_processor, ValueError)
8481

8582
try:
8683
raise ValueError("aha!")
@@ -432,9 +429,9 @@ def test_attachments(sentry_init, capture_envelopes):
432429

433430
this_file = os.path.abspath(__file__.rstrip("c"))
434431

435-
with configure_scope() as scope:
436-
scope.add_attachment(bytes=b"Hello World!", filename="message.txt")
437-
scope.add_attachment(path=this_file)
432+
scope = Scope.get_isolation_scope()
433+
scope.add_attachment(bytes=b"Hello World!", filename="message.txt")
434+
scope.add_attachment(path=this_file)
438435

439436
capture_exception(ValueError())
440437

@@ -466,8 +463,7 @@ def test_attachments_graceful_failure(
466463
sentry_init()
467464
envelopes = capture_envelopes()
468465

469-
with configure_scope() as scope:
470-
scope.add_attachment(path="non_existent")
466+
Scope.get_isolation_scope().add_attachment(path="non_existent")
471467
capture_exception(ValueError())
472468

473469
(envelope,) = envelopes

0 commit comments

Comments
 (0)