Add local_test_with_api.sh — full test suite including cloud model tests
Browse files- local_test_with_api.sh +87 -0
local_test_with_api.sh
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# ═══════════════════════════════════════════════════════════════
|
| 3 |
+
# purpose-agent v3.0.0 — Local Test Runner (including cloud model)
|
| 4 |
+
#
|
| 5 |
+
# Run on your own machine (no HF credits needed):
|
| 6 |
+
# git clone https://huggingface.co/Rohan03/purpose-agent pa && cd pa
|
| 7 |
+
# pip install -e .
|
| 8 |
+
# export OPENROUTER_API_KEY="sk-or-v1-..."
|
| 9 |
+
# bash local_test_with_api.sh
|
| 10 |
+
# ═══════════════════════════════════════════════════════════════
|
| 11 |
+
set -e
|
| 12 |
+
|
| 13 |
+
PASS=0; FAIL=0; TOTAL=0
|
| 14 |
+
|
| 15 |
+
run_test() {
|
| 16 |
+
local name="$1"; local cmd="$2"
|
| 17 |
+
echo ""
|
| 18 |
+
echo "══════════════════════════════════════════════════════════"
|
| 19 |
+
echo " Running: $name"
|
| 20 |
+
echo "══════════════════════════════════════════════════════════"
|
| 21 |
+
if eval "$cmd"; then
|
| 22 |
+
echo " ✅ $name PASSED"; PASS=$((PASS+1))
|
| 23 |
+
else
|
| 24 |
+
echo " ❌ $name FAILED"; FAIL=$((FAIL+1))
|
| 25 |
+
fi
|
| 26 |
+
TOTAL=$((TOTAL+1))
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
echo "╔══════════════════════════════════════════════════════════╗"
|
| 30 |
+
echo "║ purpose-agent v3.0.0 — Full Test Suite (Local + Cloud)║"
|
| 31 |
+
echo "╚══════════════════════════════════════════════════════════╝"
|
| 32 |
+
|
| 33 |
+
# Pre-flight
|
| 34 |
+
echo "═══ Pre-flight ═══"
|
| 35 |
+
python -c "
|
| 36 |
+
import purpose_agent as pa
|
| 37 |
+
print(f' v{pa.__version__} — {len(pa.__all__)} exports')
|
| 38 |
+
assert pa.__version__ == '3.0.0', f'Version: {pa.__version__}'
|
| 39 |
+
assert len(pa.__all__) >= 110, f'Exports: {len(pa.__all__)}'
|
| 40 |
+
missing = [n for n in pa.__all__ if not hasattr(pa, n)]
|
| 41 |
+
assert not missing, f'Missing: {missing}'
|
| 42 |
+
print(' ✅ All exports importable')
|
| 43 |
+
"
|
| 44 |
+
|
| 45 |
+
# Apply fixes
|
| 46 |
+
echo ""
|
| 47 |
+
echo "═══ Applying test fixes ═══"
|
| 48 |
+
python apply_fixes.py
|
| 49 |
+
|
| 50 |
+
# Layer 1: Unit Tests
|
| 51 |
+
run_test "test_core" "python tests/test_core.py"
|
| 52 |
+
run_test "test_public_api_211" "python tests/compat/test_public_api_211.py"
|
| 53 |
+
run_test "test_first_principles" "python tests/test_first_principles.py"
|
| 54 |
+
run_test "test_hardening" "python tests/test_hardening.py"
|
| 55 |
+
run_test "test_sre_regression" "python tests/test_sre_regression.py"
|
| 56 |
+
|
| 57 |
+
# Layer 2: Feature Tests
|
| 58 |
+
run_test "test_sprint1_events" "python tests/test_sprint1_events.py"
|
| 59 |
+
run_test "test_sprint2_checkpoint" "python tests/test_sprint2_checkpoint.py"
|
| 60 |
+
run_test "test_sprint3_homeostasis" "python tests/test_sprint3_homeostasis.py"
|
| 61 |
+
run_test "test_sprint4_8_protocols" "python tests/test_sprint4_8_protocols.py"
|
| 62 |
+
run_test "test_track_c" "python tests/test_track_c.py"
|
| 63 |
+
run_test "test_track_d" "python tests/test_track_d.py"
|
| 64 |
+
|
| 65 |
+
# Layer 3: Integration
|
| 66 |
+
run_test "validate_quick" "python benchmarks/validate.py --quick"
|
| 67 |
+
run_test "benchmark_v3" "python -m purpose_agent.benchmark_v3"
|
| 68 |
+
|
| 69 |
+
# Layer 4: Cloud Model Tests
|
| 70 |
+
if [ -n "$OPENROUTER_API_KEY" ]; then
|
| 71 |
+
run_test "prod_test (real model)" "python tests/prod_test.py"
|
| 72 |
+
else
|
| 73 |
+
echo " ⚠️ OPENROUTER_API_KEY not set — skipping cloud tests"
|
| 74 |
+
fi
|
| 75 |
+
|
| 76 |
+
# Report
|
| 77 |
+
echo ""
|
| 78 |
+
echo "╔══════════════════════════════════════════════════════════╗"
|
| 79 |
+
echo "║ RESULTS: $PASS/$TOTAL passed, $FAIL failed"
|
| 80 |
+
if [ $FAIL -eq 0 ]; then
|
| 81 |
+
echo "║ ✅ ALL TESTS PASSED — READY TO PUBLISH"
|
| 82 |
+
echo "║ Next: python build_and_publish.py"
|
| 83 |
+
else
|
| 84 |
+
echo "║ ❌ $FAIL FAILURES — FIX BEFORE PUBLISHING"
|
| 85 |
+
fi
|
| 86 |
+
echo "╚══════════════════════════════════════════════════════════╝"
|
| 87 |
+
exit $FAIL
|