Skip to content

Commit

Permalink
mypy-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelyaakoby committed Jul 19, 2024
1 parent c6f2bab commit 49a6982
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pyctuator/health/aioredis_health_provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
from typing import Any, Coroutine, Mapping

from pyctuator.health.health_provider import Status
from pyctuator.health.redis_health_provider import RedisHealthStatus, RedisHealthDetails, RedisHealthProvider
Expand All @@ -7,7 +8,7 @@
class AioRedisHealthProvider(RedisHealthProvider):
def get_health(self) -> RedisHealthStatus:
try:
info = asyncio.run(self.redis.info())
info: Mapping[str, Any] = self.redis.info()

return RedisHealthStatus(
status=Status.UP,
Expand Down
4 changes: 3 additions & 1 deletion tests/health/test_aioredis_health_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import importlib.util
import os
from typing import Any

import pytest
from redis import Redis

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

redis_instance = AioRedis(host=redis_host)
redis_instance: Redis[bytes] = AioRedis(host=redis_host)

health = AioRedisHealthProvider(redis_instance).get_health()
assert health == RedisHealthStatus(Status.UP, RedisHealthDetails("5.0.3", "standalone"))
Expand Down
4 changes: 2 additions & 2 deletions tests/health/test_redis_health_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_redis_health(redis_host: str) -> None:
from pyctuator.health.redis_health_provider import RedisHealthProvider, RedisHealthStatus, RedisHealthDetails

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


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

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

0 comments on commit 49a6982

Please sign in to comment.