DFiP_Budget_planing/api/tests/unit/test_runtime_deps.py
Andrey Epifancev b0dcc0b0f5 fix(deps): явно ставить greenlet в dev-окружении через sqlalchemy[asyncio]
SQLAlchemy не объявляет greenlet без extra asyncio. На arm64 (macOS)
и на Python >= 3.13 greenlet не ставится, и async-движок падает с
"the greenlet library is required". Тест фиксирует наличие greenlet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 18:11:10 +04:00

12 lines
696 B
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.

import sqlalchemy.util.concurrency as concurrency
def test_greenlet_is_installed_for_async_sqlalchemy():
# Async engine (create_async_engine + run_sync в alembic/env.py) требует greenlet.
# SQLAlchemy не ставит его сам на arm64 и на Python >= 3.13, поэтому зависимость
# объявлена явно через extra sqlalchemy[asyncio] в requirements-dev.txt.
assert concurrency.have_greenlet, (
"greenlet не установлен: async-движок SQLAlchemy не будет работать. "
"Установите зависимости через api/requirements-dev.txt (extra sqlalchemy[asyncio])."
)