/
tinypot
/
integr
Обзор
Документация
Войти
/
tinypot
/
integr
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
task_management_api/tests/conftest.py
34 строки
745 B
Tim Polus
lab1
21 янв 2026, 23:15
21 янв 2026, 23:15
dd1578c
Код
Авторство
О чём код?
""" Test configuration and fixtures """ import asyncio from typing import Generator import pytest from fastapi.testclient import TestClient # Import with error handling for different test scenarios try: from main import app APP_AVAILABLE = True except ImportError: APP_AVAILABLE = False app = None @pytest.fixture(scope="session") def event_loop(): """Create an instance of the default event loop for the test session.""" loop = asyncio.get_event_loop_policy().new_event_loop() yield loop loop.close() @pytest.fixture def client(): """Create test client""" if not APP_AVAILABLE: pytest.skip("App not available for testing") with TestClient(app) as test_client: yield test_client