-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (65 loc) · 2.12 KB
/
Makefile
File metadata and controls
72 lines (65 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.PHONY: help setup test test-unit test-integration clean coverage
# Default target
help:
@echo "TaskShift Test Suite"
@echo ""
@echo "Usage:"
@echo " make setup Setup test environment (create venv, install deps)"
@echo " make test Run all tests"
@echo " make test-unit Run unit tests only"
@echo " make test-integration Run integration tests only"
@echo " make coverage Run tests with coverage report"
@echo " make clean Clean test artifacts"
@echo ""
# Setup test environment
setup:
@echo "=== Setting up test environment ==="
@if [ ! -d ".venv" ]; then \
python3 -m venv .venv; \
echo "Virtual environment created"; \
else \
echo "Virtual environment already exists"; \
fi
@. .venv/bin/activate && pip install --upgrade pip -q
@. .venv/bin/activate && pip install -r requirements-test.txt -q
@echo "=== Setup complete ==="
# Run all tests
test: test-unit
# Run unit tests
test-unit:
@echo "=== Running Unit Tests ==="
@if [ ! -d ".venv" ]; then \
echo "Error: Virtual environment not found. Run 'make setup' first."; \
exit 1; \
fi
@. .venv/bin/activate && pytest tests/unit -v --tb=short --maxfail=10
# Run integration tests
test-integration:
@echo "=== Running Integration Tests ==="
@if [ ! -d ".venv" ]; then \
echo "Error: Virtual environment not found. Run 'make setup' first."; \
exit 1; \
fi
@. .venv/bin/activate && pytest tests/integration -v --tb=short --maxfail=5
# Run tests with coverage
coverage:
@echo "=== Running Tests with Coverage ==="
@if [ ! -d ".venv" ]; then \
echo "Error: Virtual environment not found. Run 'make setup' first."; \
exit 1; \
fi
@. .venv/bin/activate && pytest tests/unit --cov=src --cov-report=term --cov-report=html --cov-report=xml
@echo ""
@echo "Coverage report generated:"
@echo " - Terminal: see above"
@echo " - HTML: htmlcov/index.html"
@echo " - XML: coverage.xml"
# Clean test artifacts
clean:
@echo "Cleaning test artifacts..."
@rm -rf .pytest_cache
@rm -rf htmlcov
@rm -f coverage.xml
@rm -f .coverage
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
@echo "Clean complete"