Skip to content

Commit 7bb861a

Browse files
committed
Fix Python 3.13 coverage by adding pragma comments
Python 3.13 was missing coverage on memory backend paths in conftest.py fixtures. Added pragma: no cover comments to the memory backend paths that are only hit when REDIS_VERSION=memory. Lines fixed: - redis_server fixture: yield None and return statements - redis_port fixture: memory backend return path - redis_url fixture: memory backend URL generation
1 parent 5f5fcf1 commit 7bb861a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/conftest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def redis_server(
6767
testrun_uid: str, worker_id: str
6868
) -> Generator[Container | None, None, None]:
6969
# Skip Redis container setup for memory backend
70-
if REDIS_VERSION == "memory":
71-
yield None
72-
return
70+
if REDIS_VERSION == "memory": # pragma: no branch
71+
yield None # pragma: no cover
72+
return # pragma: no cover
7373

7474
client = DockerClient.from_env() # pragma: no cover
7575

@@ -143,9 +143,9 @@ def redis_server(
143143

144144
@pytest.fixture
145145
def redis_port(redis_server: Container | None) -> int:
146-
if redis_server is None:
146+
if redis_server is None: # pragma: no branch
147147
# Memory backend - return dummy port
148-
return 0
148+
return 0 # pragma: no cover
149149
port_bindings = redis_server.attrs["HostConfig"]["PortBindings"][
150150
"6379/tcp"
151151
] # pragma: no cover
@@ -162,10 +162,10 @@ def redis_db(worker_id: str) -> int:
162162

163163
@pytest.fixture
164164
def redis_url(redis_port: int, redis_db: int, worker_id: str) -> str:
165-
if REDIS_VERSION == "memory":
165+
if REDIS_VERSION == "memory": # pragma: no branch
166166
# Use memory:// URL for in-memory backend
167167
# Include worker_id to ensure each test worker has isolated data
168-
return f"memory://test-{worker_id}-{uuid4()}"
168+
return f"memory://test-{worker_id}-{uuid4()}" # pragma: no cover
169169

170170
url = f"redis://localhost:{redis_port}/{redis_db}" # pragma: no cover
171171
with _sync_redis(url) as r: # pragma: no cover

0 commit comments

Comments
 (0)