Conversation
|
I know you didn't ask for a review from my side, but here is it anyway 😝 Also, I am curious to hear your experiences with this as mine weren't so useful so far. |
|
@observingClouds You will not be responsible for writing tests for code that is already ignored, even if you touch those functions by calling them from your own new code. You also don't have to write tests for everything, you can ignore lines from coverage. But then you have to consciously choose so. :) |
mfroelund
left a comment
There was a problem hiding this comment.
Like it! Ambitious with 100% coverage. I'm ok with it, but maybe we should discuss it on a Tuesday meeting. I somewhat like the "# pragma" comments, since it makes it very clear what parts of the code that are uncovered, although it can seem a lot with all those comments at a first glance.
|
Thanks for setting this up @matschreiner! I agree with @mafdmi that we should maybe discuss what this will practical mean for development? I am not very familiar with coverage and I think it would be good to for whole team to understand this before we adopt a particular way of working. Let's discuss tomorrow :) Things I would like to understand is:
|
|
@leifdenby @mafdmi A line is covered if it has been executed while running the test suite. So in the following example the lines until the first return out will be covererd. This means that we don't know if we have some logic that might be failing. Of course it is not a guarantee that our testing logic is solid, we have to test the edgecases ourselves. To get full coverage of the above code we would write another test I think it's quite the task for anyone to write tests for every single uncovered line in the entire repo, so in this PR I have simply ignored all uncovered lines. But going forward I think it is fair that each person is responsible for testing their own code. If parts of the code is too hard to test or if you for some other reason actively don't want to test it, you can ignore it with
And this is serves as a useful warning to have in the codebase for the reviewer or other users that that this part of the code has not been consciously not been tested. |
This PR introduces test coverage enforcement and improves test reliability:
I have added pytest-cov to the install in the workflows file to ensure coverage measurement is available.
I set a 100% coverage requirement (--cov-fail-under=100) to enforce full test coverage for new code.
Applied # pragma: no cover to all pre-existing, untested code to avoid unnecessary coverage failures.
These changes help maintain strict coverage standards while allowing legacy code to remain untouched. 🚀
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change (add section where missing):
Checklist for assignee