File size: 3,099 Bytes
df97e68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
# ───────────────────────────────────────────────────────────────────
# run_all_tests.sh  β€” Full Phase 1 + Phase 2 validation suite
# Usage: bash run_all_tests.sh [--fast] [--api-only] [--unit-only]
# ───────────────────────────────────────────────────────────────────
set -e

# Colors
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
RED="\033[0;31m"
NC="\033[0m"

FAST=false
API_ONLY=false
UNIT_ONLY=false

for arg in "$@"; do
  case $arg in
    --fast)       FAST=true ;;
    --api-only)   API_ONLY=true ;;
    --unit-only)  UNIT_ONLY=true ;;
  esac
done

echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN}  Gov Workflow OpenEnv β€” Test Suite     ${NC}"
echo -e "${GREEN}========================================${NC}"

# ── Phase 1: Unit Tests ───────────────────────────────────────────
if [ "$API_ONLY" = false ]; then
  echo -e "\n${YELLOW}[Phase 1] Running model schema tests...${NC}"
  python.exe -m pytest tests/test_phase1_models.py -v --tb=short

  echo -e "\n${YELLOW}[Phase 1] Running sector profile + task tests...${NC}"
  python.exe -m pytest tests/test_phase1_sector_and_tasks.py -v --tb=short

  echo -e "\n${YELLOW}[Phase 1] Running event engine tests...${NC}"
  python.exe -m pytest tests/test_phase1_event_engine.py -v --tb=short

  echo -e "\n${YELLOW}[Phase 1] Running signal computer tests...${NC}"
  python.exe -m pytest tests/test_phase1_signal_computer.py -v --tb=short
fi

# ── Phase 2: Integration Tests ────────────────────────────────────
if [ "$UNIT_ONLY" = false ]; then
  echo -e "\n${YELLOW}[Phase 2] Running env integration tests...${NC}"
  python.exe -m pytest tests/test_phase2_env_integration.py -v --tb=short

  echo -e "\n${YELLOW}[Phase 2] Running simulator tests...${NC}"
  python.exe -m pytest tests/test_phase2_simulator.py -v --tb=short

  echo -e "\n${YELLOW}[Phase 2] Running API endpoint tests (TestClient)...${NC}"
  python.exe -m pytest tests/test_phase2_api.py -v --tb=short
fi

# ── Summary ───────────────────────────────────────────────────────
echo -e "\n${GREEN}========================================${NC}"
echo -e "${GREEN}  All test suites completed.${NC}"
echo -e "${GREEN}========================================${NC}"

# Full coverage report
if [ "$FAST" = false ]; then
  echo -e "\n${YELLOW}Running full coverage report...${NC}"
  python.exe -m pytest tests/ \
    --cov=app \
    --cov-report=term-missing \
    --cov-report=html:htmlcov \
    -q 2>/dev/null || true
  echo -e "${GREEN}Coverage report written to htmlcov/index.html${NC}"
fi