Files
windyboy f7e54692a9 Initial project setup: Obsidian intelligent journal organizer
- Add core agent architecture with Command + Skill pattern
- Implement Claude API integration for content analysis
- Add Obsidian REST API integration for vault operations
- Create conversational interface (v2.0) with natural language processing
- Add comprehensive configuration management and validation
- Include project documentation and developer guides
- Set up testing framework with unit, integration, and property tests
- Add Kiro specs for Claude API configuration and code quality improvements
- Configure project steering files for development guidelines
2025-12-31 17:55:10 +08:00

91 lines
2.7 KiB
Python

#!/usr/bin/env python3
"""
Test runner script for the journal organizer project.
Provides easy access to run different types of tests.
"""
import sys
import subprocess
from pathlib import Path
def run_command(cmd, description):
"""Run a command and handle the result"""
print(f"\n{'='*60}")
print(f"Running: {description}")
print(f"Command: {' '.join(cmd)}")
print('='*60)
try:
result = subprocess.run(cmd, check=True, capture_output=False)
print(f"\n{description} - PASSED")
return True
except subprocess.CalledProcessError as e:
print(f"\n{description} - FAILED (exit code: {e.returncode})")
return False
def main():
"""Main test runner"""
if len(sys.argv) < 2:
print("Usage: python run_tests.py [unit|integration|all|coverage]")
print("\nOptions:")
print(" unit - Run unit tests only")
print(" integration - Run integration tests only (may have import issues)")
print(" all - Run all tests")
print(" coverage - Run tests with coverage report")
print(" help - Show this help message")
return
test_type = sys.argv[1].lower()
if test_type == "help":
main()
return
# Base pytest command
base_cmd = ["python", "-m", "pytest", "-v"]
success = True
if test_type == "unit":
cmd = base_cmd + ["tests/unit/"]
success = run_command(cmd, "Unit Tests")
elif test_type == "integration":
cmd = base_cmd + ["tests/integration/"]
success = run_command(cmd, "Integration Tests")
elif test_type == "all":
# Run unit tests first
cmd = base_cmd + ["tests/unit/"]
success = run_command(cmd, "Unit Tests")
if success:
# Run integration tests
cmd = base_cmd + ["tests/integration/"]
success = run_command(cmd, "Integration Tests") and success
elif test_type == "coverage":
cmd = base_cmd + ["--cov=.", "--cov-report=term-missing", "--cov-report=html:htmlcov", "tests/unit/"]
success = run_command(cmd, "Unit Tests with Coverage")
if success:
print(f"\n📊 Coverage report generated in htmlcov/index.html")
else:
print(f"Unknown test type: {test_type}")
print("Use 'python run_tests.py help' for usage information")
return
# Summary
print(f"\n{'='*60}")
if success:
print("🎉 All tests completed successfully!")
else:
print("💥 Some tests failed. Check the output above for details.")
print('='*60)
if __name__ == "__main__":
main()