Skip to content

Commit fdf794f

Browse files
authored
ref(sqlalchemy): Use new scopes API in tests (#2899)
1 parent d43c175 commit fdf794f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/integrations/sqlalchemy/test_sqlalchemy.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
from sqlalchemy.orm import relationship, sessionmaker
1010
from sqlalchemy import text
1111

12-
from sentry_sdk import capture_message, start_transaction, configure_scope
12+
from sentry_sdk import capture_message, start_transaction
1313
from sentry_sdk.consts import DEFAULT_MAX_VALUE_LENGTH, SPANDATA
1414
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
15+
from sentry_sdk.scope import Scope
1516
from sentry_sdk.serializer import MAX_EVENT_BYTES
1617
from sentry_sdk.tracing_utils import record_sql_queries
1718
from sentry_sdk.utils import json_dumps
@@ -226,12 +227,12 @@ def test_large_event_not_truncated(sentry_init, capture_events):
226227

227228
long_str = "x" * (DEFAULT_MAX_VALUE_LENGTH + 10)
228229

229-
with configure_scope() as scope:
230+
scope = Scope.get_isolation_scope()
230231

231-
@scope.add_event_processor
232-
def processor(event, hint):
233-
event["message"] = long_str
234-
return event
232+
@scope.add_event_processor
233+
def processor(event, hint):
234+
event["message"] = long_str
235+
return event
235236

236237
engine = create_engine("sqlite:///:memory:")
237238
with start_transaction(name="test"):

0 commit comments

Comments
 (0)