Files
mtusi2026lab2/tests_student/conftest.py
T
Ильяс 9ddb2244bc
Skeleton contracts / contracts (pull_request) Canceled after 0s
feat: ЛР2 - PostgreSQL, Redis сессии и keyset-пагинация
2026-10-23 12:45:58 +03:00

20 lines
529 B
Python

from __future__ import annotations
import os
import pytest
from httpx import ASGITransport, AsyncClient
@pytest.fixture
async def client():
base_url = os.getenv("BASE_URL", "http://localhost:8080")
if base_url.startswith("http://testserver"):
from app.main import app
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://testserver") as ac:
yield ac
else:
async with AsyncClient(base_url=base_url) as ac:
yield ac