Skip to main content
Glama
conftest.py1.02 kB
"""Конфигурация и фикстуры для тестов.""" import asyncio from collections.abc import AsyncGenerator, Generator import pytest from fastapi import FastAPI from httpx import AsyncClient from app.main import app @pytest.fixture(scope="session") def event_loop() -> Generator[asyncio.AbstractEventLoop, None, None]: """Создает event loop для асинхронных тестов.""" try: loop = asyncio.get_event_loop() except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) yield loop loop.close() @pytest.fixture def test_app() -> FastAPI: """Фикстура для тестового приложения FastAPI.""" return app @pytest.fixture async def async_client(test_app: FastAPI) -> AsyncGenerator[AsyncClient, None]: """Фикстура для асинхронного клиента.""" async with AsyncClient(app=test_app, base_url="http://test") as client: yield client

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eagurin/myaiserv'

If you have feedback or need assistance with the MCP directory API, please join our Discord server