-
Notifications
You must be signed in to change notification settings - Fork 3
Stop excluding tests from coverage #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop excluding tests from coverage #69
Conversation
Codecov Report
@@ Coverage Diff @@
## main #69 +/- ##
===========================================
Coverage 100.00% 100.00%
===========================================
Files 58 110 +52
Lines 2314 5415 +3101
===========================================
+ Hits 2314 5415 +3101
Continue to review full report at Codecov.
|
I am in favor of coverage for the tests. It would not be the first time I copied a working test and forgot to change the name |
Success! We now have 100% coverage, including all 3101 lines of tests. This was very much a worthwhile exercise. There were pieces of functionality that were not being tested, generally due to tiny errors in the test suite (in one case, a Ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, feel free to merge
Back in March, I saw a tweet from Ned Batchelder linking to this:
https://nedbatchelder.com/blog/202008/you_should_include_your_tests_in_coverage.html
Since then, I've been considering including test suites in coverage. This PR adds the test suite to the coverage data. Consider this a proposal, because I'm not necessarily wedded to the idea we have to do this. But please read Ned's blog post, and consider if doing this affects your workflow in any way.
My own thoughts on the concerns Ned's post mentions:
pytest --cov=paths_cli/wizard paths_cli/tests/wizard/
).The only other issue I see is that I consider "non-test statements" to be a good figure for a minimal lines-of-code estimate. This number is trivial to get from the current setup. It's a little harder to get if test are included in coverage (need to click on the tests/ directory in the file browser view of CodeCov, then at the bottom do the math on "Project totals - Folder totals"). I think Ned's arguments in favor including tests in coverage outweigh this minor inconvenience. It looks like this points out a few corners of code that are missing coverage, so it might be worth it. (There are also areas that probably can be ignored in coverage, like
RuntimeError('pytest went crazy')
).If there's general support for this approach, I'll move forward with bringing this PR back up to 100% coverage.