Skip to content

Commit 4db63eb

Browse files
committed
.
1 parent fc080db commit 4db63eb

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

sentry_sdk/integrations/asyncio.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ async def _task_with_sentry_span_creation() -> "Any":
6464
integration = sentry_sdk.get_client().get_integration(
6565
AsyncioIntegration
6666
)
67-
task_spans = (
68-
integration.task_spans if integration is not None else True
69-
)
67+
task_spans = integration.task_spans if integration else False
7068

7169
with sentry_sdk.isolation_scope():
7270
with (

tests/integrations/asyncio/test_asyncio.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,6 @@ async def test_task_spans_false(
402402
capture_events,
403403
uninstall_integration,
404404
):
405-
"""
406-
Test that task_spans=False disables span creation but retains scope isolation.
407-
"""
408405
uninstall_integration("asyncio")
409406

410407
sentry_init(
@@ -417,18 +414,14 @@ async def test_task_spans_false(
417414
events = capture_events()
418415

419416
with sentry_sdk.start_transaction(name="test_no_spans"):
420-
with sentry_sdk.start_span(op="root", name="root span"):
421-
tasks = [asyncio.create_task(foo()), asyncio.create_task(bar())]
422-
await asyncio.wait(tasks, return_when=asyncio.FIRST_EXCEPTION)
417+
tasks = [asyncio.create_task(foo()), asyncio.create_task(bar())]
418+
await asyncio.wait(tasks, return_when=asyncio.FIRST_EXCEPTION)
423419

424420
sentry_sdk.flush()
425421

426422
(transaction_event,) = events
427423

428-
# Only the root span should be present, no asyncio spans
429-
assert len(transaction_event["spans"]) == 1
430-
assert transaction_event["spans"][0]["op"] == "root"
431-
assert transaction_event["spans"][0]["description"] == "root span"
424+
assert not transaction_event["spans"]
432425

433426

434427
@minimum_python_38
@@ -460,7 +453,6 @@ async def test_enable_asyncio_integration_with_task_spans_false(
460453
sentry_sdk.flush()
461454

462455
(transaction,) = events
463-
# No asyncio spans should be created
464456
assert not transaction["spans"]
465457

466458

0 commit comments

Comments
 (0)