test: add coverage reporting

This commit is contained in:
2026-06-21 14:25:02 +03:30
parent 24ee55a069
commit d04dca2646
4 changed files with 37 additions and 0 deletions

View File

@@ -1012,6 +1012,13 @@ cd backend
$env:TEST_DATABASE_ENGINE='sqlite'; .\.venv\Scripts\python.exe -m pytest
```
Run backend tests with coverage:
```powershell
cd backend
$env:TEST_DATABASE_ENGINE='sqlite'; .\.venv\Scripts\python.exe -m pytest --cov --cov-report=term-missing
```
The test suite covers:
- successful claim

View File

@@ -9,3 +9,25 @@ select = ["E", "W", "F", "I", "B", "C4", "UP", "DJ", "SIM"]
"jobs/models.py" = ["DJ001"]
"jobs/migrations/*.py" = ["E501"]
"jobs/tests/*.py" = ["DJ001"]
[tool.coverage.run]
branch = true
source = ["config", "jobs"]
omit = [
"config/asgi.py",
"config/wsgi.py",
"jobs/management/*",
"*/migrations/*",
"*/tests/*",
"manage.py",
]
[tool.coverage.report]
show_missing = true
skip_covered = true
fail_under = 60
exclude_lines = [
"pragma: no cover",
"if __name__ == .__main__.:",
"raise NotImplementedError",
]

View File

@@ -7,4 +7,5 @@ psycopg[binary]>=3.2,<4.0
django-unfold>=0.76,<1.0
pytest>=8.0,<9.0
pytest-django>=4.9,<5.0
pytest-cov>=6.0,<7.0
ruff>=0.15,<0.16