-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·115 lines (96 loc) · 3.15 KB
/
run_tests.sh
File metadata and controls
executable file
·115 lines (96 loc) · 3.15 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# Test runner script for Pale Fire
set -e
echo "🧪 Pale Fire Test Suite"
echo "======================="
echo ""
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if pytest is installed
if ! command -v pytest &> /dev/null; then
echo -e "${YELLOW}⚠️ pytest not found. Installing test dependencies...${NC}"
pip install -r requirements.txt
fi
# Parse arguments
MODE=${1:-all}
case $MODE in
all)
echo -e "${BLUE}Running all tests...${NC}"
pytest tests/ -v
;;
unit)
echo -e "${BLUE}Running unit tests...${NC}"
pytest tests/ -v -m unit
;;
integration)
echo -e "${BLUE}Running integration tests...${NC}"
pytest tests/ -v -m integration
;;
coverage)
echo -e "${BLUE}Running tests with coverage...${NC}"
pytest tests/ -v --cov=. --cov-report=html --cov-report=term
echo ""
echo -e "${GREEN}✅ Coverage report generated in htmlcov/index.html${NC}"
;;
fast)
echo -e "${BLUE}Running fast tests (excluding slow)...${NC}"
pytest tests/ -v -m "not slow"
;;
config)
echo -e "${BLUE}Testing configuration module...${NC}"
pytest tests/test_config.py -v
;;
core)
echo -e "${BLUE}Testing PaleFireCore module...${NC}"
pytest tests/test_palefire_core.py -v
;;
search)
echo -e "${BLUE}Testing search functions...${NC}"
pytest tests/test_search_functions.py -v
;;
api)
echo -e "${BLUE}Testing API...${NC}"
pytest tests/test_api.py -v
;;
watch)
echo -e "${BLUE}Running tests in watch mode...${NC}"
if command -v pytest-watch &> /dev/null; then
pytest-watch tests/
else
echo -e "${YELLOW}⚠️ pytest-watch not installed. Install with: pip install pytest-watch${NC}"
exit 1
fi
;;
help|--help|-h)
echo "Usage: ./run_tests.sh [MODE]"
echo ""
echo "Modes:"
echo " all - Run all tests (default)"
echo " unit - Run only unit tests"
echo " integration - Run only integration tests"
echo " coverage - Run tests with coverage report"
echo " fast - Run fast tests (exclude slow)"
echo " config - Test config module only"
echo " core - Test PaleFireCore module only"
echo " search - Test search functions only"
echo " api - Test API only"
echo " watch - Run tests in watch mode"
echo " help - Show this help message"
echo ""
echo "Examples:"
echo " ./run_tests.sh # Run all tests"
echo " ./run_tests.sh coverage # Run with coverage"
echo " ./run_tests.sh config # Test config only"
exit 0
;;
*)
echo -e "${YELLOW}Unknown mode: $MODE${NC}"
echo "Run './run_tests.sh help' for usage information"
exit 1
;;
esac
echo ""
echo -e "${GREEN}✅ Tests completed!${NC}"