File size: 684 Bytes
e636f34 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 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
|