#!/usr/bin/env bash
# Run the ha-mcp test suite (offline: no network, no HA instance, no token).
# Uses services/ha-mcp/.venv when present, else whatever python3 has pytest.
set -euo pipefail

TESTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SERVICE_DIR="$(dirname "$TESTS_DIR")"
VENV_PY="$SERVICE_DIR/.venv/bin/python"

PY="${VENV_PY}"
[[ -x "$PY" ]] || PY="$(command -v python3)"

exec "$PY" -m pytest "$TESTS_DIR" "$@"
