more refactoring
This commit is contained in:
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/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())
|
||||
Reference in New Issue
Block a user