mirror of
https://github.com/d3vyce/taskiq-deduplication.git
synced 2026-08-04 19:14:07 +00:00
test: add real-Redis integration tests (#45)
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user