Skip to content

Commit 3de2b21

Browse files
fix: resolve ruff lint violations in test files
- F841: unused `conn` variables in test_pool.py - SIM105: try/except/pass replaced with contextlib.suppress - F401: unused AsyncMock import in test_retry.py Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b15619d commit 3de2b21

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

tests/test_pool.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for connection pooling."""
22

3+
import contextlib
34
from unittest.mock import AsyncMock, MagicMock, patch
45

56
import pytest
@@ -104,18 +105,16 @@ async def test_cancellation_does_not_leak_connection(self) -> None:
104105
acquired = asyncio.Event()
105106

106107
async def hold_connection():
107-
async with pool.acquire() as conn:
108+
async with pool.acquire() as _:
108109
acquired.set()
109110
await asyncio.sleep(10) # Hold forever
110111

111112
task = asyncio.create_task(hold_connection())
112113
await acquired.wait() # Deterministic: wait until connection is acquired
113114

114115
task.cancel()
115-
try:
116+
with contextlib.suppress(asyncio.CancelledError):
116117
await task
117-
except asyncio.CancelledError:
118-
pass
119118

120119
# Connection should have been closed, size decremented
121120
mock_conn.close.assert_called()
@@ -188,7 +187,7 @@ async def test_close_handles_checked_out_connections(self) -> None:
188187

189188
# Acquire a connection (checks it out)
190189
ctx = pool.acquire()
191-
conn = await ctx.__aenter__()
190+
await ctx.__aenter__()
192191

193192
# Close the pool while connection is checked out
194193
await pool.close()

tests/test_retry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def raise_type_error() -> str:
7474

7575
async def test_respects_max_delay(self) -> None:
7676
"""Verify that the backoff delay is capped at max_delay."""
77-
from unittest.mock import AsyncMock, patch
77+
from unittest.mock import patch
7878

7979
call_count = 0
8080
sleep_args: list[float] = []

0 commit comments

Comments
 (0)