|
| 1 | +# Makefile for MCP Sequential Thinking Server |
| 2 | +# Provides convenient commands for testing and development |
| 3 | + |
| 4 | +.PHONY: help test test-unit test-integration test-security test-config test-fast test-debug test-quiet test-parallel test-coverage test-junit check-types lint check-all clean |
| 5 | + |
| 6 | +# Default target: show help |
| 7 | +help: |
| 8 | + @echo "MCP Sequential Thinking Server - Test Commands" |
| 9 | + @echo "" |
| 10 | + @echo "Test Execution:" |
| 11 | + @echo " make test - Run all tests with coverage (default)" |
| 12 | + @echo " make test-unit - Run only unit tests" |
| 13 | + @echo " make test-integration - Run only integration tests" |
| 14 | + @echo " make test-security - Run only security tests" |
| 15 | + @echo " make test-config - Run only configuration tests" |
| 16 | + @echo " make test-fast - Run tests without coverage (faster)" |
| 17 | + @echo " make test-debug - Run tests in debug mode (verbose)" |
| 18 | + @echo " make test-quiet - Run tests with minimal output" |
| 19 | + @echo " make test-parallel - Run tests in parallel" |
| 20 | + @echo "" |
| 21 | + @echo "Coverage & Reports:" |
| 22 | + @echo " make test-coverage - Run tests with HTML coverage report" |
| 23 | + @echo " make test-junit - Run tests with JUnit XML report" |
| 24 | + @echo "" |
| 25 | + @echo "Code Quality:" |
| 26 | + @echo " make check-types - Run mypy type checking" |
| 27 | + @echo " make lint - Run ruff linting" |
| 28 | + @echo " make check-all - Run all quality checks (tests + types + lint)" |
| 29 | + @echo "" |
| 30 | + @echo "Cleanup:" |
| 31 | + @echo " make clean - Remove test artifacts and cache files" |
| 32 | + |
| 33 | +# Run all tests with coverage (default behavior) |
| 34 | +test: |
| 35 | + @echo "Running all tests with coverage..." |
| 36 | + @uv run pytest tests/ --cov=src/mcp_server_mas_sequential_thinking --cov-report=term-missing -v --tb=short |
| 37 | + @$(MAKE) -s check-types |
| 38 | + @$(MAKE) -s lint |
| 39 | + |
| 40 | +# Run only unit tests |
| 41 | +test-unit: |
| 42 | + @echo "Running unit tests..." |
| 43 | + @uv run pytest tests/unit/ --cov=src/mcp_server_mas_sequential_thinking --cov-report=term-missing -v --tb=short |
| 44 | + @$(MAKE) -s check-types |
| 45 | + @$(MAKE) -s lint |
| 46 | + |
| 47 | +# Run only integration tests |
| 48 | +test-integration: |
| 49 | + @echo "Running integration tests..." |
| 50 | + @uv run pytest tests/integration/ --cov=src/mcp_server_mas_sequential_thinking --cov-report=term-missing -v --tb=short |
| 51 | + @$(MAKE) -s check-types |
| 52 | + @$(MAKE) -s lint |
| 53 | + |
| 54 | +# Run only security tests (using markers) |
| 55 | +test-security: |
| 56 | + @echo "Running security tests..." |
| 57 | + @uv run pytest -m security --cov=src/mcp_server_mas_sequential_thinking --cov-report=term-missing -v --tb=short |
| 58 | + @$(MAKE) -s check-types |
| 59 | + @$(MAKE) -s lint |
| 60 | + |
| 61 | +# Run only configuration tests (using markers) |
| 62 | +test-config: |
| 63 | + @echo "Running configuration tests..." |
| 64 | + @uv run pytest -m config --cov=src/mcp_server_mas_sequential_thinking --cov-report=term-missing -v --tb=short |
| 65 | + @$(MAKE) -s check-types |
| 66 | + @$(MAKE) -s lint |
| 67 | + |
| 68 | +# Run tests without coverage (faster) |
| 69 | +test-fast: |
| 70 | + @echo "Running tests without coverage (fast mode)..." |
| 71 | + @uv run pytest tests/ -v --tb=short --no-cov |
| 72 | + |
| 73 | +# Run tests in debug mode (verbose, no capture, long tracebacks) |
| 74 | +test-debug: |
| 75 | + @echo "Running tests in debug mode..." |
| 76 | + @uv run pytest tests/ -vv -s --tb=long --no-cov |
| 77 | + |
| 78 | +# Run tests with minimal output |
| 79 | +test-quiet: |
| 80 | + @echo "Running tests (quiet mode)..." |
| 81 | + @uv run pytest tests/ -q --tb=short --no-cov |
| 82 | + |
| 83 | +# Run tests in parallel |
| 84 | +test-parallel: |
| 85 | + @echo "Running tests in parallel..." |
| 86 | + @uv run pytest tests/ --cov=src/mcp_server_mas_sequential_thinking --cov-report=term-missing -v --tb=short -n auto |
| 87 | + @$(MAKE) -s check-types |
| 88 | + @$(MAKE) -s lint |
| 89 | + |
| 90 | +# Run tests with HTML coverage report |
| 91 | +test-coverage: |
| 92 | + @echo "Running tests with HTML coverage report..." |
| 93 | + @uv run pytest tests/ --cov=src/mcp_server_mas_sequential_thinking --cov-report=term-missing --cov-report=html -v --tb=short |
| 94 | + @echo "Coverage report generated in htmlcov/index.html" |
| 95 | + @$(MAKE) -s check-types |
| 96 | + @$(MAKE) -s lint |
| 97 | + |
| 98 | +# Run tests with JUnit XML report |
| 99 | +test-junit: |
| 100 | + @echo "Running tests with JUnit XML report..." |
| 101 | + @uv run pytest tests/ --cov=src/mcp_server_mas_sequential_thinking --cov-report=term-missing -v --tb=short --junit-xml=test-results.xml |
| 102 | + @echo "JUnit report generated: test-results.xml" |
| 103 | + @$(MAKE) -s check-types |
| 104 | + @$(MAKE) -s lint |
| 105 | + |
| 106 | +# Run mypy type checking |
| 107 | +check-types: |
| 108 | + @echo "Type checking with mypy..." |
| 109 | + @uv run mypy src --ignore-missing-imports |
| 110 | + |
| 111 | +# Run ruff linting |
| 112 | +lint: |
| 113 | + @echo "Linting with ruff..." |
| 114 | + @uv run ruff check src tests |
| 115 | + |
| 116 | +# Run all quality checks (tests, type checking, linting) |
| 117 | +check-all: test check-types lint |
| 118 | + @echo "All quality checks passed!" |
| 119 | + |
| 120 | +# Clean up test artifacts and cache files |
| 121 | +clean: |
| 122 | + @echo "Cleaning test artifacts and cache files..." |
| 123 | + @rm -rf .pytest_cache .coverage htmlcov test-results.xml |
| 124 | + @find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true |
| 125 | + @find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true |
| 126 | + @find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true |
| 127 | + @echo "Clean complete!" |
0 commit comments