mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 02:31:45 +01:00
chore: improve coverage reporting (#683)
## ℹ️ Description * Restrict coverage reporting to library files and collect per-suite coverage data for Codecov’s flags. - Link to the related issue(s): Issue #N/A - Describe the motivation and context for this change. ## 📋 Changes Summary - add `coverage:prepare` and per-suite `COVERAGE_FILE`s so each test group writes its own sqlite and XML artifacts without appending - replace the shell scripts with `scripts/coverage_helper.py`, scope the report to `src/kleinanzeigen_bot/*`, and add logging/validation around cleanup, pytest runs, and data combining - ensure the helper works in CI (accepts extra pytest args, validates file presence) ### ⚙️ Type of Change - [x] 🐞 Bug fix (non-breaking change which fixes an issue) - [ ] ✨ New feature (adds new functionality without breaking existing usage) - [ ] 💥 Breaking change (changes that might break existing user setups, scripts, or configurations) ## ✅ Checklist - [x] I have reviewed my changes to ensure they meet the project's standards. - [x] I have tested my changes and ensured that all tests pass (`pdm run test`). - [x] I have formatted the code (`pdm run format`). - [x] I have verified that linting passes (`pdm run lint`). - [x] I have updated documentation where necessary.
This commit is contained in:
@@ -123,11 +123,12 @@ test = { composite = ["utest", "itest", "smoke"] }
|
||||
# Coverage scripts:
|
||||
# - Each group writes its own data file to .temp/.coverage.<group>.xml
|
||||
#
|
||||
"test:cov" = { composite = ["utest:cov", "itest:cov", "smoke:cov", "coverage:combine"] }
|
||||
"utest:cov" = { shell = "python -m pytest --capture=tee-sys -m \"not itest and not smoke\" --cov=src/kleinanzeigen_bot --cov-report=xml:.temp/coverage-unit.xml --cov-append" }
|
||||
"itest:cov" = { shell = "python -m pytest --capture=tee-sys -m \"itest and not smoke\" --cov=src/kleinanzeigen_bot --cov-report=xml:.temp/coverage-integration.xml --cov-append" }
|
||||
"smoke:cov" = { shell = "python -m pytest --capture=tee-sys -m smoke --cov=src/kleinanzeigen_bot --cov-report=xml:.temp/coverage-smoke.xml --cov-append" }
|
||||
"coverage:combine" = { shell = "coverage report -m" }
|
||||
"coverage:prepare" = { shell = "python scripts/coverage_helper.py prepare" }
|
||||
"test:cov" = { composite = ["coverage:prepare", "utest:cov", "itest:cov", "smoke:cov", "coverage:combine"] }
|
||||
"utest:cov" = { shell = "python scripts/coverage_helper.py run .temp/.coverage-unit.sqlite .temp/coverage-unit.xml \"not itest and not smoke\"" }
|
||||
"itest:cov" = { shell = "python scripts/coverage_helper.py run .temp/.coverage-itest.sqlite .temp/coverage-integration.xml \"itest and not smoke\"" }
|
||||
"smoke:cov" = { shell = "python scripts/coverage_helper.py run .temp/.coverage-smoke.sqlite .temp/coverage-smoke.xml smoke" }
|
||||
"coverage:combine" = { shell = "python scripts/coverage_helper.py combine .temp/.coverage-unit.sqlite .temp/.coverage-itest.sqlite .temp/.coverage-smoke.sqlite" }
|
||||
# Run all tests with coverage in a single invocation
|
||||
"test:cov:unified" = "python -m pytest --capture=tee-sys --cov=src/kleinanzeigen_bot --cov-report=term-missing"
|
||||
|
||||
@@ -375,6 +376,7 @@ relative_files = true
|
||||
precision = 2
|
||||
show_missing = true
|
||||
skip_covered = false
|
||||
include = ["src/kleinanzeigen_bot/*"]
|
||||
|
||||
#####################
|
||||
# yamlfix
|
||||
|
||||
Reference in New Issue
Block a user