#!/usr/bin/env python3 """Test runner for the community bot project.""" import sys import subprocess import os def run_tests(): """Run all tests for the community bot project.""" print("Running community bot tests...") # Change to the project directory project_dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(project_dir) # Run pytest try: result = subprocess.run([ sys.executable, "-m", "pytest", "tests/", "-v", "--tb=short", "--color=yes" ], check=True) print("\nāœ… All tests passed!") return 0 except subprocess.CalledProcessError as e: print(f"\nāŒ Tests failed with exit code {e.returncode}") return e.returncode except FileNotFoundError: print("āŒ pytest not found. Please install it with: pip install pytest") return 1 if __name__ == "__main__": sys.exit(run_tests())