test: add real-Redis integration tests (#45)

This commit is contained in:
d3vyce
2026-06-02 19:18:32 +02:00
committed by GitHub
parent f9d326ba02
commit 56be33d5b5
6 changed files with 193 additions and 56 deletions
+18
View File
@@ -1,5 +1,8 @@
from typing import Awaitable, cast
import pytest
import fakeredis.aioredis
from redis.asyncio import Redis
from taskiq import TaskiqMessage, TaskiqResult
@@ -15,6 +18,21 @@ async def fake_redis():
await client.aclose()
@pytest.fixture
async def real_redis():
client = Redis.from_url("redis://localhost:6379/15")
try:
await cast(Awaitable[bool], client.ping())
except Exception:
await client.aclose()
pytest.skip("Redis not available at localhost:6379")
return
await client.flushdb()
yield client
await client.flushdb()
await client.aclose()
@pytest.fixture
def make_message():
def _make(task_name="my_task", task_id="task-1", labels=None, kwargs=None):