Skip to content

Commit 9ad3478

Browse files
committed
...
1 parent ccfc5a1 commit 9ad3478

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/integrations/asgi/test_asgi.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ async def app(scope, receive, send):
4848

4949
@pytest.fixture
5050
def asgi3_app_with_error():
51+
async def send_with_error(event):
52+
1 / 0
53+
5154
async def app(scope, receive, send):
52-
await send(
55+
await send_with_error(
5356
{
5457
"type": "http.response.start",
5558
"status": 200,
@@ -58,10 +61,7 @@ async def app(scope, receive, send):
5861
],
5962
}
6063
)
61-
62-
1 / 0
63-
64-
await send(
64+
await send_with_error(
6565
{
6666
"type": "http.response.body",
6767
"body": b"Hello, world!",
@@ -167,9 +167,9 @@ async def test_capture_transaction_with_error(
167167
sentry_init(send_default_pii=True, traces_sample_rate=1.0)
168168
app = SentryAsgiMiddleware(asgi3_app_with_error)
169169

170+
events = capture_events()
170171
with pytest.raises(ZeroDivisionError):
171172
async with TestClient(app) as client:
172-
events = capture_events()
173173
await client.get("/")
174174

175175
(error_event, transaction_event) = events
@@ -423,7 +423,7 @@ async def test_transaction_style(
423423
events = capture_events()
424424
await client.get(url)
425425

426-
(_, transaction_event) = events
426+
(transaction_event,) = events
427427

428428
assert transaction_event["transaction"] == expected_transaction
429429
assert transaction_event["transaction_info"] == {"source": expected_source}

0 commit comments

Comments
 (0)