|
15 | 15 | from sentry_sdk import (
|
16 | 16 | get_client,
|
17 | 17 | push_scope,
|
18 |
| - configure_scope, |
19 | 18 | capture_event,
|
20 | 19 | capture_exception,
|
21 | 20 | capture_message,
|
@@ -74,13 +73,11 @@ def test_processors(sentry_init, capture_events):
|
74 | 73 | sentry_init()
|
75 | 74 | events = capture_events()
|
76 | 75 |
|
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 |
82 | 79 |
|
83 |
| - scope.add_error_processor(error_processor, ValueError) |
| 80 | + Scope.get_isolation_scope().add_error_processor(error_processor, ValueError) |
84 | 81 |
|
85 | 82 | try:
|
86 | 83 | raise ValueError("aha!")
|
@@ -432,9 +429,9 @@ def test_attachments(sentry_init, capture_envelopes):
|
432 | 429 |
|
433 | 430 | this_file = os.path.abspath(__file__.rstrip("c"))
|
434 | 431 |
|
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) |
438 | 435 |
|
439 | 436 | capture_exception(ValueError())
|
440 | 437 |
|
@@ -466,8 +463,7 @@ def test_attachments_graceful_failure(
|
466 | 463 | sentry_init()
|
467 | 464 | envelopes = capture_envelopes()
|
468 | 465 |
|
469 |
| - with configure_scope() as scope: |
470 |
| - scope.add_attachment(path="non_existent") |
| 466 | + Scope.get_isolation_scope().add_attachment(path="non_existent") |
471 | 467 | capture_exception(ValueError())
|
472 | 468 |
|
473 | 469 | (envelope,) = envelopes
|
|
0 commit comments