fix(gate): clear the xenon complexity failure + fixable test warnings

- transcript_retention.py: split select_prunable_transcripts into small helpers
  so the module averages complexity rank A (was B — failed make quality / xenon).
- pyproject: move the markers table from [tool.coverage.run] (coverage warned
  'Unrecognized option') to [tool.pytest.ini_options] where it belongs.
- HTTP_422_UNPROCESSABLE_ENTITY -> HTTP_422_UNPROCESSABLE_CONTENT (old name
  deprecated) in the tasks/product/settings routes + the validation middleware.
- conftest: drop pool_pre_ping on the per-test engine — pointless for a fresh
  per-test engine and it leaves an un-awaited asyncpg Connection._cancel
  coroutine that surfaced as a RuntimeWarning across ~30 integration tests.
This commit is contained in:
Renn F
2026-06-12 23:51:45 +02:00
parent 320499811b
commit b034c64177
7 changed files with 30 additions and 20 deletions
+4 -1
View File
@@ -214,7 +214,10 @@ async def db_session(_test_database_url: str) -> AsyncIterator[AsyncSession]:
Each test gets its own session and connection; teardown rolls back any
uncommitted state and disposes the engine to keep connection counts low.
"""
engine = create_async_engine(_test_database_url, future=True, pool_pre_ping=True)
# No pool_pre_ping: a fresh per-test engine can't have stale connections, and
# pre-ping on asyncpg leaves an un-awaited Connection._cancel coroutine that
# surfaces as a RuntimeWarning during GC.
engine = create_async_engine(_test_database_url, future=True)
factory = async_sessionmaker(
bind=engine, class_=AsyncSession, expire_on_commit=False
)