"""`/health` is the load-balancer probe — it must keep working even when the engine bridge is absent (Phase 0 default).""" from fastapi.testclient import TestClient def test_health_returns_ok(client: TestClient) -> None: response = client.get("/health") assert response.status_code == 200 payload = response.json() assert payload["status"] == "ok" assert payload["engine_available"] is False assert "version" in payload assert "environment" in payload def test_health_does_not_require_engine(client: TestClient) -> None: """Regression guard: importing the app and hitting /health must not transitively import the pybind11 module (which doesn't exist yet).""" import sys had_pdfengine = "pdfengine" in sys.modules pdfengine_module = sys.modules.pop("pdfengine", None) try: response = client.get("/health") assert response.status_code == 200 assert "pdfengine" not in sys.modules finally: if had_pdfengine and pdfengine_module is not None: sys.modules["pdfengine"] = pdfengine_module