mirror of
https://github.com/Dodelidoo-Labs/sonobarr.git
synced 2026-04-18 05:08:21 -04:00
1.3 KiB
1.3 KiB
Automated Testing and Coverage
This project includes an automated pytest suite covering core services, web flows, socket handlers, and edge-case helper branches.
Prerequisites
Install dependencies in the required environment:
path/to/python-venv/bin/pip install -r requirements.txt
path/to/python-venv/bin/pip install pytest pytest-cov
Run Tests
PYTHONPATH=src path/to/python-venv -m pytest
Generate Coverage Reports
PYTHONPATH=src path/to/python-venv -m pytest \
--cov=src/sonobarr_app \
--cov-report=term-missing \
--cov-report=xml
This command writes:
coverage.xmlfor SonarQube ingestion.coveragefor local coverage tooling
CI Build Workflow
The GitHub build workflow runs the coverage command before SonarQube analysis in the same job. This keeps SonarQube metrics aligned with the latest tests without uploading build artifacts.
Coverage Target
- The active target is 100% line coverage.
- Keep branch-focused regression tests when adding new helpers or error handling paths so the target remains stable.
Notes for SonarQube
- Keep using the generated
coverage.xmlas the coverage report input for scanner runs. - Re-run the coverage command after code changes to ensure SonarQube receives current metrics.