CodeCov during development

Hey All,

I like how we have now added a Code Coverage gate in the build pipeline to improve our overall test code coverage. Especially not allowing PRs to reduce the abount of coverage and that new code should have 100% coverage.

However, seeing how a build for a PR takes around 40 minutes, it is quiet slow to get feedback around that and can take a while to make sure you get that 100% coveage on your PR.

Is there a quick way to run the CodeCov during development to make sure you have coverage for your patch? I don;t mean run the full buld locally (as that takes around an hour), but do we have tools that allow us to check the coverage before you push your PR?



Use pytest with pytest-cov plugin directly with the --cov=path/to/files/ option. Google is your friend for finding the documentation on this. I recommend doing something like pytest --cov=homeassistant/components/myintegration tests/components/myintegration to get the summary for only the myintegration tests.

The scripts folder also had a lazytox runner, but I don’t know if it can be configured to test with coverage for a particular interesting.