#!/bin/bash # Test runner script for AegisGitea MCP set -e echo "=========================================" echo "AegisGitea MCP - Test Suite" echo "=========================================" echo "" # Colors GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Check if virtual environment exists if [ ! -d "venv" ]; then echo -e "${YELLOW}Virtual environment not found. Creating...${NC}" python3 -m venv venv fi # Activate virtual environment source venv/bin/activate # Install dependencies echo -e "${YELLOW}Installing dependencies...${NC}" pip install -q -r requirements-dev.txt echo "" echo "=========================================" echo "Running Tests" echo "=========================================" echo "" # Run tests with coverage pytest tests/ \ -v \ --cov=aegis_gitea_mcp \ --cov-report=term-missing \ --cov-report=html \ --tb=short TEST_EXIT_CODE=$? echo "" echo "=========================================" echo "Test Summary" echo "=========================================" echo "" if [ $TEST_EXIT_CODE -eq 0 ]; then echo -e "${GREEN}✓ All tests passed!${NC}" echo "" echo "Coverage report generated in htmlcov/" echo "Open htmlcov/index.html in your browser to view detailed coverage." else echo -e "${RED}✗ Some tests failed${NC}" echo "" echo "Please review the errors above and fix them." exit 1 fi echo "" echo "=========================================" echo "Running Linters" echo "=========================================" echo "" # Run ruff echo "Running ruff..." ruff check src/ tests/ || true # Run mypy echo "Running mypy..." mypy src/ || true echo "" echo -e "${GREEN}Test suite complete!${NC}"