forked from mtusi2026/mtusi2026lab4
feat: перенос структуры приложения из третьей лабы
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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
|
||||
Reference in New Issue
Block a user