import subprocess
import sys
import os

def verify_phase_4():
 print("Verifying Phase 4: Contextual Auto-Switch...")
 
 result = subprocess.run(
  ["uv", "run", "pytest", "tests/test_auto_switch_sim.py"],
  capture_output=True,
  text=True
 )
 
 if result.returncode == 0:
  print("Phase 4 verification PASSED.")
 else:
  print("Phase 4 verification FAILED.")
  print(result.stdout)
  print(result.stderr)
  sys.exit(1)

if __name__ == "__main__":
 verify_phase_4()
