Skip to content

Commit 49a6982

Browse files
mypy-fixes
1 parent c6f2bab commit 49a6982

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

pyctuator/health/aioredis_health_provider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
from typing import Any, Coroutine, Mapping
23

34
from pyctuator.health.health_provider import Status
45
from pyctuator.health.redis_health_provider import RedisHealthStatus, RedisHealthDetails, RedisHealthProvider
@@ -7,7 +8,7 @@
78
class AioRedisHealthProvider(RedisHealthProvider):
89
def get_health(self) -> RedisHealthStatus:
910
try:
10-
info = asyncio.run(self.redis.info())
11+
info: Mapping[str, Any] = self.redis.info()
1112

1213
return RedisHealthStatus(
1314
status=Status.UP,

tests/health/test_aioredis_health_provider.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import importlib.util
44
import os
5+
from typing import Any
56

67
import pytest
8+
from redis import Redis
79

810
@pytest.fixture
911
def require_redis() -> None:
@@ -28,7 +30,7 @@ def test_aioredis_health(redis_host: str) -> None:
2830
from pyctuator.health.health_provider import Status
2931
from pyctuator.health.aioredis_health_provider import AioRedisHealthProvider, RedisHealthStatus, RedisHealthDetails
3032

31-
redis_instance = AioRedis(host=redis_host)
33+
redis_instance: Redis[bytes] = AioRedis(host=redis_host)
3234

3335
health = AioRedisHealthProvider(redis_instance).get_health()
3436
assert health == RedisHealthStatus(Status.UP, RedisHealthDetails("5.0.3", "standalone"))

tests/health/test_redis_health_provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_redis_health(redis_host: str) -> None:
3030
from pyctuator.health.redis_health_provider import RedisHealthProvider, RedisHealthStatus, RedisHealthDetails
3131

3232
health = RedisHealthProvider(redis.Redis(host=redis_host)).get_health()
33-
assert health == RedisHealthStatus(Status.UP, RedisHealthDetails("5.0.3", "standalone"))
33+
assert health == RedisHealthStatus(Status.UP, RedisHealthDetails("7.2.5", "standalone"))
3434

3535

3636
@pytest.mark.usefixtures("require_redis", "require_redis_server")
@@ -41,4 +41,4 @@ def test_redis_bad_password(redis_host: str) -> None:
4141

4242
health = RedisHealthProvider(redis.Redis(host=redis_host, password="blabla")).get_health()
4343
assert health.status == Status.DOWN
44-
assert "Client sent AUTH, but no password is set" in str(health.details.failure)
44+
assert "called without any password configured for the default user" in str(health.details.failure)

0 commit comments

Comments
 (0)