feat(F071,F068,F070): Welle 2 — Refactor-Audit, Stabilitaets-Monitor, Contract-Test-Framework @implements: [F-071] [F-068] [F-070]
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# F070 — Vertrags-Test-Runner Plugin ↔ Hermes-Core.
|
||||
#
|
||||
# Führt den Contract-Test (tests/contract/test_contract_framework.py) aus.
|
||||
# Nutzt den Python-Interpreter des Hermes-Core-venv (P-029: .45-Plugin
|
||||
# nur via venv-Python testen), mit Fallback auf system-python.
|
||||
#
|
||||
# @implements: [F-070]
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
# venv-Python des Hermes-Core bevorzugen (P-029: snowballstemmer/faiss nur dort)
|
||||
CANDIDATES=(
|
||||
"$HOME/.hermes/hermes-agent/venv/bin/python"
|
||||
"$HOME/.local/share/pipx/venvs/hermes-agent/bin/python"
|
||||
"/usr/local/lib/hermes-agent/venv/bin/python"
|
||||
)
|
||||
PY=""
|
||||
for cand in "${CANDIDATES[@]}"; do
|
||||
if [ -x "$cand" ]; then PY="$cand"; break; fi
|
||||
done
|
||||
if [ -z "$PY" ]; then PY="$(command -v python3 || echo python3)"; fi
|
||||
|
||||
echo "[f070] Python: $PY"
|
||||
echo "[f070] Repo: $REPO_ROOT"
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
PYTEST_RC=99
|
||||
CLI_RC=99
|
||||
|
||||
# 1) pytest-basiert (Hauptpfad)
|
||||
echo "[f070] == pytest: tests/contract/test_contract_framework.py =="
|
||||
if "$PY" -m pytest tests/contract/test_contract_framework.py -q -p no:cacheprovider 2>&1; then
|
||||
PYTEST_RC=0
|
||||
else
|
||||
PYTEST_RC=$?
|
||||
fi
|
||||
echo "[f070] pytest exit=$PYTEST_RC"
|
||||
|
||||
# 2) Standalone-CLI (Runner-Pfad) — erzeugt den Mensch-lesbaren Contract-Bericht
|
||||
echo "[f070] == Standalone: python tests/contract/test_contract_framework.py =="
|
||||
if "$PY" tests/contract/test_contract_framework.py 2>&1; then
|
||||
CLI_RC=0
|
||||
else
|
||||
CLI_RC=$?
|
||||
fi
|
||||
echo "[f070] standalone exit=$CLI_RC"
|
||||
|
||||
# Exit: Fail, wenn einer der beiden Pfade fehlschlägt.
|
||||
if [ "$PYTEST_RC" -ne 0 ] || [ "$CLI_RC" -ne 0 ]; then
|
||||
echo "[f070] 🔴 Contract-Test FEHLGESCHLAGEN (pytest=$PYTEST_RC, cli=$CLI_RC)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[f070] 🟢 Contract-Test bestanden (pytest + Standalone)."
|
||||
Reference in New Issue
Block a user