"""Integration: boot the real app against a live Postgres. Creating the app with testing=False runs the core Alembic migrations AND every bundled plugin's migrations (discovered across all plugin roots). This is the canonical guard that the folded-in plugin migration graph resolves end-to-end — a pure-unit test can't catch a broken plugin revision chain. Requires STEWARD_DATABASE_URL pointing at a live Postgres; the integration CI lane provides it. Skipped automatically when unset so the unit lane stays green. """ from __future__ import annotations import asyncio import os import pytest pytestmark = pytest.mark.integration @pytest.mark.skipif( not os.environ.get("STEWARD_DATABASE_URL"), reason="integration test needs a live Postgres (STEWARD_DATABASE_URL)", ) def test_real_boot_runs_all_migrations(): from sqlalchemy import text from steward.app import create_app # testing=False → init_db + run_core_migrations (core + all bundled-plugin # migrations) + load_settings_sync + load_plugins all execute here. app = create_app(testing=False) assert app is not None async def _roundtrip(): async with app.db_sessionmaker() as session: # app_settings exists only if core migrations actually applied. result = await session.execute(text("SELECT COUNT(*) FROM app_settings")) return result.scalar() count = asyncio.run(_roundtrip()) assert count is not None