feat(tests): Add test configuration and helpers
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-08-23 22:17:53 +01:00
parent 3e04433272
commit 9e815b0619
7 changed files with 71 additions and 45 deletions

21
tests/conftest.py Normal file
View File

@@ -0,0 +1,21 @@
import pytest
from httpx import AsyncClient, ASGITransport
from app.main import app
@pytest.fixture(scope="session")
def anyio_backend():
"""
Это фикстура, необходимая для pytest-asyncio, чтобы он работал
с httpx в асинхронном режиме. Просто стандартный шаблон.
"""
return "asyncio"
@pytest.fixture
async def client() -> AsyncClient:
"""
Главная фикстура. Создает тестовый клиент, который мы будем
использовать во всех наших тестах.
"""
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://test") as async_client:
yield async_client