-
A proposal to change how we monitor and report the test coverage of our codebase. Current StateCurrently, our project's code test coverage is reported to be around 97%. However, this high percentage is artificially maintained by excluding files that do not meet our coverage threshold using the ObjectiveThe primary goal of this proposal is to obtain a more accurate insight into our actual test coverage and identify areas for improvement. ProposalI propose to stop excluding files from test coverage reports for all integrations. By doing so, coverage tools like CodeCov will provide a more accurate representation of our coverage gaps. This change will:
ImpactAccepting this proposal will result in a significant drop in reported test coverage. However, CodeCov will continue to ensure 100% coverage for essential files (e.g., configuration flows), as it currently does. For reference the current configuration at the time of writing: coverage:
status:
project:
default:
target: 90
threshold: 0.09
required:
target: auto
threshold: 1
paths:
- homeassistant/components/*/config_flow.py
- homeassistant/components/*/device_action.py
- homeassistant/components/*/device_condition.py
- homeassistant/components/*/device_trigger.py
- homeassistant/components/*/diagnostics.py
- homeassistant/components/*/group.py
- homeassistant/components/*/intent.py
- homeassistant/components/*/logbook.py
- homeassistant/components/*/media_source.py
- homeassistant/components/*/recorder.py
- homeassistant/components/*/scene.py Implementation planImplementing the suggested changes requires two changes:
The Codecov default project threshold might need to be re-evaluated afterward. Optional future enhancements
Changelog4 July, 2024, 15:24 CEST: Adjusted the proposal to remove all coverage exclusions (instead of only integrations/components). |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
How can we avoid the review annotations from codecov on non covered lines for integrations that don't aim to add tests? Those are very annoying during review when a module is completely uncovered. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Seems reasonable, a lot of tests are missed when they are added to This may be for a separate ADR, but there is the potential of splitting components from the rest of the codebase:
This would allow target(s) could be set higher for internal / core code and lower for the community for example. Moving components/integrations to a different file structure could potentially allow a more fine tuned coverage report, such as moving core components under their own directory etc. |
Beta Was this translation helpful? Give feedback.
-
This seems like a v.good idea to me, I’ve never really understood why integrations could be excluded from coverage and I think it drives a misunderstanding of whether the tests should be exercising the HA code or the code of the dependency library. The |
Beta Was this translation helpful? Give feedback.
PR: home-assistant/core#121286