Complete training workflow and acceptance hardening

This commit is contained in:
andreysk0304 2026-09-26 18:12:27 +03:00 • committed by gglamer
commit 7237265833
243 changed files with 17014 additions and 1500 deletions

View file

@ -6,6 +6,8 @@
"""
import os
import socket
from urllib.parse import urlparse
os.environ.setdefault("DEV_AUTH_BYPASS", "true")
@ -14,6 +16,24 @@ import pytest # noqa: E402
from app.config import get_settings # noqa: E402
@pytest.fixture
def postgres_access():
"""Skip DB integration cases when the configured PostgreSQL is unreachable.
`/api/health` is a liveness endpoint and deliberately does not probe the
database. Use a short TCP check so sandbox/network-denied runs are reported
as unverified integration tests instead of misleading application failures.
"""
url = urlparse(get_settings().database_url)
if url.scheme not in {"postgres", "postgresql", "postgresql+asyncpg"}:
pytest.skip("PostgreSQL integration test requires a PostgreSQL DATABASE_URL")
try:
with socket.create_connection((url.hostname or "localhost", url.port or 5432), timeout=2):
pass
except OSError as exc:
pytest.skip(f"PostgreSQL unavailable ({exc})")
@pytest.fixture(autouse=True, scope="session")
def _dev_auth():
"""Флаг обхода читается один раз при создании настроек."""