From 6106bd0666a99914cb3a56377aacdff296a949bc Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Thu, 21 Nov 2024 16:54:59 +0100 Subject: [PATCH] Fix asyncio tests --- tests/integrations/asyncio/test_asyncio.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/integrations/asyncio/test_asyncio.py b/tests/integrations/asyncio/test_asyncio.py index c9e572ca73..f122f1b804 100644 --- a/tests/integrations/asyncio/test_asyncio.py +++ b/tests/integrations/asyncio/test_asyncio.py @@ -74,7 +74,7 @@ async def test_create_task( events = capture_events() - with sentry_sdk.start_transaction(name="test_transaction_for_create_task"): + with sentry_sdk.start_span(name="test_transaction_for_create_task"): with sentry_sdk.start_span(op="root", name="not so important"): tasks = [event_loop.create_task(foo()), event_loop.create_task(bar())] await asyncio.wait(tasks, return_when=asyncio.FIRST_EXCEPTION) @@ -117,7 +117,7 @@ async def test_gather( events = capture_events() - with sentry_sdk.start_transaction(name="test_transaction_for_gather"): + with sentry_sdk.start_span(name="test_transaction_for_gather"): with sentry_sdk.start_span(op="root", name="not so important"): await asyncio.gather(foo(), bar(), return_exceptions=True) @@ -160,7 +160,8 @@ async def test_exception( events = capture_events() - with sentry_sdk.start_transaction(name="test_exception"): + with sentry_sdk.start_span(name="test_exception"): + sentry_sdk.get_isolation_scope().set_transaction_name("test_exception") with sentry_sdk.start_span(op="root", name="not so important"): tasks = [event_loop.create_task(boom()), event_loop.create_task(bar())] await asyncio.wait(tasks, return_when=asyncio.FIRST_EXCEPTION) @@ -375,7 +376,7 @@ async def test_span_origin( events = capture_events() - with sentry_sdk.start_transaction(name="something"): + with sentry_sdk.start_span(name="something"): tasks = [ event_loop.create_task(foo()), ]