import httpx import pytest from lincodex_ml.main import app @pytest.fixture def anyio_backend() -> str: return "asyncio" @pytest.mark.anyio async def test_health_reports_process_liveness() -> None: async with httpx.AsyncClient( transport=httpx.ASGITransport(app=app), base_url="http://test" ) as client: response = await client.get("/healthz") assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.anyio async def test_readiness_reports_missing_inference_runtime() -> None: async with httpx.AsyncClient( transport=httpx.ASGITransport(app=app), base_url="http://test" ) as client: response = await client.get("/readyz") assert response.status_code == 503 assert response.json() == {"status": "not_ready"} @pytest.mark.anyio async def test_metrics_endpoint_exposes_prometheus_registry() -> None: async with httpx.AsyncClient( transport=httpx.ASGITransport(app=app), base_url="http://test", follow_redirects=True, ) as client: response = await client.get("/metrics") assert response.status_code == 200 assert "python_info" in response.text