arm-core/api/tests/e2e/conftest.py
Andrey Epifancev f361fae79b test(e2e): сквозной прогон загрузки ОСВ через compose с реальным tabular-parser
Тест tests/e2e (маркеры integration, e2e, fixtures): полное приложение src.app.app с lifespan на временной БД,
реальные NATS и MinIO, tabular-parser из профиля services; ОСВ 66 за 2024 -> PROCESSED, документ 66/2024/Q4,
9 строк, counterparty_check = MATCH, status = RECOGNIZED; без профиля — skip. Makefile: цель e2e, check-full
включает e2e, test-integration исключает e2e. README: раздел «Сквозной прогон (e2e)».

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vJkmBGKKqMoEMzvsXG3y2
2026-10-05 23:55:23 +04:00

26 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Предусловия сквозных тестов (Срез 2c, tasks 5.1): сервис tabular-parser из профиля `services` compose.
Без него e2e не имеет смысла (результат распознавания даёт реальный парсер): тест пропускается с причиной, а
`make check-full` без профиля остаётся зелёным. NATS, MinIO и PostgreSQL берутся из `.env.test` (инфраструктура
compose `make up`); профиль поднимается командой из README («Сквозной прогон (e2e)»).
"""
import httpx
import pytest
TABULAR_PARSER_HEALTHCHECK = "http://localhost:8001/healthcheck"
HEALTHCHECK_TIMEOUT = 2.0
SKIP_REASON = "профиль services не поднят"
@pytest.fixture(scope="session")
def tabular_parser_ready() -> None:
"""`GET localhost:8001/healthcheck` отвечает 200 и `nats=ok`, иначе — skip «профиль services не поднят»."""
try:
response = httpx.get(TABULAR_PARSER_HEALTHCHECK, timeout=HEALTHCHECK_TIMEOUT)
ready = response.status_code == httpx.codes.OK and response.json().get("nats") == "ok"
except (httpx.HTTPError, ValueError):
ready = False
if not ready:
pytest.skip(f"{SKIP_REASON}: {TABULAR_PARSER_HEALTHCHECK} недоступен или без подключения к NATS")