- Add GitHub Actions CI pipeline with pytest, ruff, mypy - Expand Tasks.md with implementation tracking and testing criteria - Update CONTRIBUTING.md with CI requirements - Add Testing-Requirements.md with coverage thresholds and PR checks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
39 lines
991 B
Markdown
39 lines
991 B
Markdown
# Testing Requirements
|
|
|
|
## Coverage Threshold
|
|
|
|
- **Minimum: 80% line coverage** for all backend code
|
|
- Critical paths (auth, banning, scheduling, API endpoints): **100%**
|
|
|
|
## CI Enforcement
|
|
|
|
`.github/workflows/ci.yml` runs pytest with `--cov-fail-under=80`. Build fails if coverage drops below threshold.
|
|
|
|
## Running Tests Locally
|
|
|
|
```bash
|
|
cd backend
|
|
pytest --cov=app --cov-report=term-missing
|
|
```
|
|
|
|
## Coverage Reports
|
|
|
|
- Terminal: `--cov-report=term-missing`
|
|
- HTML: `--cov-report=html` (output in `htmlcov/`)
|
|
|
|
## Coverage Badge
|
|
|
|
Add to README once CI runs successfully:
|
|
|
|
```md
|
|
[](https://codecov.io/gh/<owner>/BanGUI)
|
|
```
|
|
|
|
Requires codecov.io integration with repository.
|
|
|
|
## Writing Tests
|
|
|
|
- Follow pattern: `test_<unit>_<scenario>_<expected>`
|
|
- Mock external dependencies (fail2ban socket, aiohttp calls)
|
|
- Test happy path AND error/edge cases
|
|
- See `Docs/Backend-Development.md §9` for detailed testing guide |