File size: 2,146 Bytes
acd8e16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# NL→SQL Leaderboard Tests

This directory contains all test files for the NL→SQL Leaderboard project.

## Test Structure

```
test/
β”œβ”€β”€ __init__.py              # Test package initialization
β”œβ”€β”€ conftest.py              # Pytest configuration and fixtures
β”œβ”€β”€ test_config.py           # Configuration loading tests
β”œβ”€β”€ test_evaluation.py       # Evaluation pipeline tests
β”œβ”€β”€ test_models.py           # Model testing utilities
β”œβ”€β”€ test_system.py           # System integration tests
└── README.md                # This file
```

## Running Tests

### Quick Test Run
```bash
python run_tests.py
```

### Using pytest directly
```bash
# Run all tests
pytest test/

# Run specific test file
pytest test/test_config.py

# Run with coverage
pytest test/ --cov=src --cov-report=html

# Run only fast tests
pytest test/ -m "not slow"
```

### Test Categories

- **Unit Tests**: Fast, isolated tests for individual components
- **Integration Tests**: Tests that verify component interactions
- **System Tests**: End-to-end tests of the complete system

## Test Configuration

Tests are configured to run in mock mode by default:
- `MOCK_MODE=true` - Uses mock SQL generation
- `HF_TOKEN=""` - Prevents real API calls
- All external dependencies are mocked

## Test Fixtures

- `mock_mode`: Ensures mock mode is enabled
- `test_data_dir`: Path to test data directory
- `config_dir`: Path to configuration directory

## Writing New Tests

1. Create test files with `test_*.py` naming
2. Use descriptive test function names starting with `test_`
3. Use fixtures from `conftest.py` when needed
4. Mark slow tests with `@pytest.mark.slow`
5. Use proper assertions and error messages

## Test Coverage

The test suite aims for comprehensive coverage:
- Configuration loading and validation
- Model registry functionality
- Evaluation pipeline
- Scoring and metrics
- UI components
- Error handling

## Continuous Integration

Tests are designed to run in CI/CD environments:
- No external dependencies required
- Mock mode prevents API calls
- Fast execution for quick feedback
- Comprehensive coverage reporting