diff --git a/run_tests.sh b/run_tests.sh index 2cbcab6..e0a6ef0 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -3,12 +3,29 @@ cd "$(dirname "$0")" -# Default to Hermes python (has pytest), fall back to system python -if [ -f "/opt/hermes/tools/python-3.14.9+202****1021-linux-x64/bin/python" ]; then - PYTHON="/opt/hermes/tools/python-3.14.9+202****1021-linux-x64/bin/python" -elif command -v python3 &>/dev/null && python3 -c "import pytest" 2>/dev/null; then - PYTHON="python3" -else +# Find python with pytest support (Hermes environment or system) +PYTHON="" + +# Try Hermes python first +for p in /opt/hermes/tools/python-*/bin/python; do + if [ -f "$p" ] && "$p" -c "import pytest" 2>/dev/null; then + PYTHON="$p" + break + fi +done + +# Fall back to system python3 with pytest +if [ -z "$PYTHON" ]; then + for cmd in python3 python; do + if command -v $cmd &>/dev/null && $cmd -c "import pytest" 2>/dev/null; then + PYTHON="$cmd" + break + fi + done +fi + +# Error if no suitable python found +if [ -z "$PYTHON" ]; then echo "Error: pytest not found. Try:" echo " pip install pytest numpy psutil Pillow" exit 1