Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 37 additions & 26 deletions tests/integrations/asyncio/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ async def test_create_task(
):
sentry_init(
traces_sample_rate=1.0,
send_default_pii=True,
integrations=[
AsyncioIntegration(),
],
data_collection={},
integrations=[AsyncioIntegration()],
)

items = capture_items("span")
Expand Down Expand Up @@ -120,10 +118,8 @@ async def test_gather(
):
sentry_init(
traces_sample_rate=1.0,
send_default_pii=True,
integrations=[
AsyncioIntegration(),
],
data_collection={},
integrations=[AsyncioIntegration()],
)

items = capture_items("span")
Expand Down Expand Up @@ -160,10 +156,8 @@ async def test_exception(
):
sentry_init(
traces_sample_rate=1.0,
send_default_pii=True,
integrations=[
AsyncioIntegration(),
],
data_collection={},
integrations=[AsyncioIntegration()],
)

events = capture_events()
Expand All @@ -189,9 +183,8 @@ async def test_exception(
@pytest.mark.asyncio(loop_scope="module")
async def test_task_result(sentry_init):
sentry_init(
integrations=[
AsyncioIntegration(),
],
integrations=[AsyncioIntegration()],
data_collection={},
)

async def add(a, b):
Expand All @@ -208,9 +201,8 @@ async def test_task_with_context(sentry_init):
Integration test to ensure working context parameter in Python 3.11+
"""
sentry_init(
integrations=[
AsyncioIntegration(),
],
integrations=[AsyncioIntegration()],
data_collection={},
)

var = ContextVar("var")
Expand Down Expand Up @@ -382,6 +374,7 @@ async def test_span_origin(
sentry_init(
integrations=[AsyncioIntegration()],
traces_sample_rate=1.0,
data_collection={},
)

items = capture_items("span")
Expand Down Expand Up @@ -414,9 +407,8 @@ async def test_task_spans_false(

sentry_init(
traces_sample_rate=1.0,
integrations=[
AsyncioIntegration(task_spans=False),
],
integrations=[AsyncioIntegration(task_spans=False)],
data_collection={},
)

items = capture_items("span")
Expand Down Expand Up @@ -447,7 +439,10 @@ async def test_enable_asyncio_integration_with_task_spans_false(
"""
uninstall_integration("asyncio")

sentry_init(traces_sample_rate=1.0)
sentry_init(
traces_sample_rate=1.0,
data_collection={},
)

assert "asyncio" not in sentry_sdk.get_client().integrations

Expand Down Expand Up @@ -478,6 +473,7 @@ async def test_delayed_enable_integration(
):
sentry_init(
traces_sample_rate=1.0,
data_collection={},
)

assert "asyncio" not in sentry_sdk.get_client().integrations
Expand Down Expand Up @@ -516,7 +512,10 @@ async def test_delayed_enable_integration(
@minimum_python_38
@pytest.mark.asyncio
async def test_delayed_enable_integration_with_options(sentry_init, capture_events):
sentry_init(traces_sample_rate=1.0)
sentry_init(
traces_sample_rate=1.0,
data_collection={},
)

assert "asyncio" not in sentry_sdk.get_client().integrations

Expand All @@ -543,7 +542,11 @@ async def test_delayed_enable_enabled_integration(sentry_init, uninstall_integra
uninstall_integration("asyncio")

integration = AsyncioIntegration()
sentry_init(integrations=[integration], traces_sample_rate=1.0)
sentry_init(
integrations=[integration],
traces_sample_rate=1.0,
data_collection={},
)

assert "asyncio" in sentry_sdk.get_client().integrations

Expand All @@ -570,6 +573,7 @@ async def test_delayed_enable_integration_after_disabling(
sentry_init(
disabled_integrations=[AsyncioIntegration()],
traces_sample_rate=1.0,
data_collection={},
)

assert "asyncio" not in sentry_sdk.get_client().integrations
Expand Down Expand Up @@ -616,6 +620,7 @@ async def test_internal_tasks_not_wrapped(
sentry_init(
integrations=[AsyncioIntegration()],
traces_sample_rate=1.0,
data_collection={},
)

async def user_task():
Expand Down Expand Up @@ -655,7 +660,10 @@ async def internal_task():

@minimum_python_38
def test_loop_close_patching(sentry_init):
sentry_init(integrations=[AsyncioIntegration()])
sentry_init(
integrations=[AsyncioIntegration()],
data_collection={},
)

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
Expand All @@ -679,7 +687,10 @@ def test_loop_close_flushes_async_transport(sentry_init):
if not ASYNC_TRANSPORT_AVAILABLE:
pytest.skip("httpcore[asyncio] not installed")

sentry_init(integrations=[AsyncioIntegration()])
sentry_init(
integrations=[AsyncioIntegration()],
data_collection={},
)

# Save the current event loop to restore it later
try:
Expand Down
Loading