We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jimmyjoe009/openf1_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
# Quick Test Reference
## Test Quick Start
### Install Dependencies
```bash
pip install -r requirements.txt
```
### Run All Unit Tests
```bash
pytest tests/
```
### Run Tests with Coverage
```bash
pytest tests/ --cov=src
```
### Run Integration Tests (requires network)
```bash
pytest tests/ --integration
```
### Run Specific Test
```bash
pytest tests/test_server.py::test_server_initialization -v
```
## Test Statistics
| Category | Count | Files |
|----------|-------|-------|
| Unit Tests - Client | 22 | test_openf1_client.py |
| Unit Tests - Server | 20 | test_server.py |
| Integration Tests | 10 | test_integration.py |
| **Total** | **~55** | **3 files** |
## Test Organization
### By Data Type
- Drivers: 3 unit tests + 1 integration test
- Teams: 2 unit tests + 1 integration test
- Races: 3 unit tests + 2 integration tests
- Sessions: 2 unit tests + 2 integration tests
- Results: 2 unit tests + 1 integration test
- Laps: 1 unit test
- Stints: 1 unit test
- Pit Stops: 1 unit test
- Weather: 1 unit test + 1 integration test
- Incidents: 1 unit test
- Car Data: 1 unit test
- Positions: 1 unit test
### By Component
- Client Methods: 22 tests
- Server Tools: 11 tests (1 per tool)
- Server Integration: 9 tests
- Error Handling: 3 tests
- Configuration: 1 test
## Test Execution Examples
### Example 1: Quick Test Run
```bash
$ pytest tests/ -q
45 passed in 0.45s
```
### Example 2: Verbose Output
```bash
$ pytest tests/ -v
tests/test_openf1_client.py::test_client_context_manager PASSED
tests/test_openf1_client.py::test_get_drivers PASSED
...
```
### Example 3: Coverage Report
```bash
$ pytest tests/ --cov=src --cov-report=term-missing
Name Stmts Miss Cover Missing
-----------------------------------------------------
src/openf1_client.py 45 0 100%
src/server.py 80 0 100%
-----------------------------------------------------
TOTAL 125 0 100%
```
### Example 4: Run Specific Test Class
```bash
pytest tests/test_server.py::test_get_tools -v
```
## Test Categories
### Client Tests (test_openf1_client.py)
✓ Context manager operations
✓ Driver queries (with/without filters)
✓ Team queries
✓ Race queries (with/without filters)
✓ Session queries
✓ Result queries
✓ Lap data queries
✓ Stint data queries
✓ Pit stop queries
✓ Weather queries
✓ Incident queries
✓ Car data queries
✓ Position queries
### Server Tests (test_server.py)
✓ Server initialization
✓ Tool registration (11 tools)
✓ Tool schemas validation
✓ Tool descriptions
✓ All 11 tool executions
✓ Error handling
### Integration Tests (test_integration.py)
✓ Real API connectivity
✓ Multi-endpoint queries
✓ Connection reuse
✓ Response structure validation
✓ Error handling
## Useful Pytest Plugins
### Install Coverage Plugin
```bash
pip install pytest-cov
```
### Run Parallel Tests (faster)
```bash
pip install pytest-xdist
pytest tests/ -n auto
```
### Run Tests in Watch Mode
```bash
pip install pytest-watch
ptw tests/
```
## Troubleshooting
### Issue: Import Errors
**Solution**: Run from project root
```bash
cd /path/to/openf1_mcp
python -m pytest tests/
```
### Issue: Tests Take Too Long
**Solution**: Skip integration tests
```bash
pytest tests/ # (integration tests skipped by default)
```
### Issue: Network Related Failures
**Solution**: Check API connectivity
```bash
# Test just unit tests without API calls
pytest tests/test_server.py tests/test_openf1_client.py
```
## CI/CD Integration
### GitHub Actions Example
```yaml
- name: Run tests
run: |
pip install -r requirements.txt
pytest tests/ --cov=src --cov-report=xml
```
### GitLab CI Example
```yaml
test:
script:
- pip install -r requirements.txt
- pytest tests/ --cov=src --cov-report=term
```
## File Locations
| File | Purpose |
|------|---------|
| `tests/test_openf1_client.py` | API client unit tests |
| `tests/test_server.py` | MCP server unit tests |
| `tests/test_integration.py` | Integration tests (optional) |
| `tests/conftest.py` | Pytest configuration |
| `pytest.ini` | Test settings |
| `run_tests.py` | Test runner script |
| `TESTING.md` | Complete testing guide |
| `TEST_SUMMARY.md` | Detailed test documentation |
## Test Execution Flow
1. **Setup** → Load fixtures and configuration
2. **Mock Data** → Inject test data into client
3. **Execute** → Run test function
4. **Assert** → Verify results
5. **Teardown** → Cleanup resources
## Next Steps
- [ ] Run unit tests: `pytest tests/`
- [ ] Check coverage: `pytest tests/ --cov=src`
- [ ] Run integration tests: `pytest tests/ --integration`
- [ ] Review failing tests in detail: `pytest tests/ -v`
- [ ] Generate HTML coverage: `pytest tests/ --cov=src --cov-report=html`