import os import requests import pytest API_BASE = os.getenv("NOVA_SIM_API_URL", "http://localhost:3004/nova-sim/api/v1") WS_BASE = os.getenv("NOVA_SIM_WS_URL", "ws://localhost:3004/nova-sim/api/v1/ws") def _ping_api() -> None: try: resp = requests.get(API_BASE, timeout=3) resp.raise_for_status() except (requests.RequestException, ValueError) as exc: pytest.skip(f"Nova-Sim API not reachable at {API_BASE}: {exc}") @pytest.fixture(scope="session") def api_base(): _ping_api() return API_BASE @pytest.fixture(scope="session") def ws_url(): # Ensure API is accessible before touching the websocket _ping_api() return WS_BASE