File size: 2,741 Bytes
0234c58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
# Test runner script for batch processing tests

set -e  # Exit on error

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

echo "========================================"
echo "Batch Processing Test Suite"
echo "========================================"
echo ""

# Check if pytest is installed
if ! command -v pytest &> /dev/null; then
    echo -e "${RED}Error: pytest not found${NC}"
    echo "Install with: pip install pytest pytest-cov"
    exit 1
fi

# Default: run all tests
TEST_SUITE="${1:-all}"

case "$TEST_SUITE" in
    "unit")
        echo -e "${YELLOW}Running Unit Tests...${NC}"
        pytest tests/test_model_manager.py -v
        ;;
    "integration")
        echo -e "${YELLOW}Running Integration Tests...${NC}"
        pytest tests/test_batch_analysis.py -v
        ;;
    "regression")
        echo -e "${YELLOW}Running Regression Tests...${NC}"
        pytest tests/test_regression_single_slide.py -v
        ;;
    "all")
        echo -e "${YELLOW}Running All Tests...${NC}"
        pytest tests/test_model_manager.py \
               tests/test_batch_analysis.py \
               tests/test_regression_single_slide.py \
               -v
        ;;
    "coverage")
        echo -e "${YELLOW}Running Tests with Coverage...${NC}"
        pytest tests/test_model_manager.py \
               tests/test_batch_analysis.py \
               tests/test_regression_single_slide.py \
               --cov=mosaic.model_manager \
               --cov=mosaic.batch_analysis \
               --cov=mosaic.analysis \
               --cov-report=term-missing \
               --cov-report=html \
               -v
        echo ""
        echo -e "${GREEN}Coverage report generated in htmlcov/index.html${NC}"
        ;;
    "quick")
        echo -e "${YELLOW}Running Quick Test (no mocks needed)...${NC}"
        pytest tests/test_model_manager.py::TestModelCache -v
        ;;
    *)
        echo -e "${RED}Unknown test suite: $TEST_SUITE${NC}"
        echo ""
        echo "Usage: $0 [unit|integration|regression|all|coverage|quick]"
        echo ""
        echo "  unit         - Run unit tests (test_model_manager.py)"
        echo "  integration  - Run integration tests (test_batch_analysis.py)"
        echo "  regression   - Run regression tests (test_regression_single_slide.py)"
        echo "  all          - Run all tests (default)"
        echo "  coverage     - Run all tests with coverage report"
        echo "  quick        - Run quick sanity test"
        exit 1
        ;;
esac

EXIT_CODE=$?

echo ""
if [ $EXIT_CODE -eq 0 ]; then
    echo -e "${GREEN}✓ All tests passed!${NC}"
else
    echo -e "${RED}✗ Some tests failed${NC}"
fi

exit $EXIT_CODE