Skip to content

Commit cb932d2

Browse files
BYKclaude
andcommitted
fix: Make test_async_worker_start_no_running_loop sync
Use a sync test to test the no-running-loop path — there's genuinely no running loop in a sync test, so no mock needed and no leaked coroutines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 156f32b commit cb932d2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/test_transport.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,16 +1250,14 @@ async def test_async_worker_start_creates_queue_and_task():
12501250
worker.kill()
12511251

12521252

1253-
@skip_under_gevent
1254-
@pytest.mark.asyncio
12551253
@pytest.mark.skipif(not PY38, reason="AsyncWorker requires Python 3.8+")
1256-
async def test_async_worker_start_no_running_loop():
1254+
def test_async_worker_start_no_running_loop():
12571255
"""Test start() handles no running event loop gracefully."""
12581256
from sentry_sdk.worker import AsyncWorker
12591257

12601258
worker = AsyncWorker()
1261-
with mock.patch("asyncio.get_running_loop", side_effect=RuntimeError("no loop")):
1262-
worker.start()
1259+
# No running loop in a sync test, so start() should handle RuntimeError
1260+
worker.start()
12631261
assert worker._loop is None
12641262
assert worker._task is None
12651263
assert worker._task_for_pid is None

0 commit comments

Comments
 (0)