Skip to content

Commit 7146a8f

Browse files
chrisguidryclaude
andauthored
Add pragma no cover to redis connection retry in conftest (#264)
The `except ConnectionError` in `_wait_for_redis` is a timing-dependent branch that's essentially impossible to reliably hit in tests - it fires when Redis hasn't started yet during container spinup. Marking it with `pragma: no cover` to avoid flaky coverage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1323b1b commit 7146a8f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tests/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from redis import ConnectionPool, Redis
1818

1919
from docket import Docket, Worker
20-
2120
from tests._key_leak_checker import KeyCountChecker
2221

2322
REDIS_VERSION = os.environ.get("REDIS_VERSION", "7.4")
@@ -59,7 +58,7 @@ def _wait_for_redis(port: int) -> None:
5958
with _administrative_redis(port) as r:
6059
if r.ping(): # type: ignore # pragma: no branch
6160
return
62-
except redis.exceptions.ConnectionError:
61+
except redis.exceptions.ConnectionError: # pragma: no cover
6362
time.sleep(0.1)
6463

6564

0 commit comments

Comments
 (0)