Files
taskiq-deduplication/tests/conftest.py
T
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>d3vyce
6b1b745d5f ⬆ bump ruff from 0.15.17 to 0.16.0 (#89)
* ⬆ bump ruff from 0.15.17 to 0.16.0

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.17 to 0.16.0.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.17...0.16.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: ruff warnings

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: d3vyce <nicolas.sudres@proton.me>
2026-07-29 10:50:48 +02:00

62 lines
1.3 KiB
Python

import fakeredis.aioredis
import pytest
from redis.asyncio import Redis
from taskiq import TaskiqMessage, TaskiqResult
@pytest.fixture
def anyio_backend():
return "asyncio"
@pytest.fixture
async def fake_redis():
client = fakeredis.aioredis.FakeRedis()
yield client
await client.aclose()
@pytest.fixture
async def real_redis():
client = Redis.from_url("redis://localhost:6379/15")
try:
await 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, args=None
):
return TaskiqMessage(
task_id=task_id,
task_name=task_name,
labels=labels or {},
labels_types={},
args=args or [],
kwargs=kwargs or {},
)
return _make
@pytest.fixture
def make_result():
def _make(is_err=False):
return TaskiqResult(
is_err=is_err,
log="",
return_value=None,
execution_time=0.0,
)
return _make