-
Notifications
You must be signed in to change notification settings - Fork 392
Fix failure to cover test code #318
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
Conversation
Filtering of test modules is a per-project policy applied during report creation. It should not be assumed or applied as a default configuration.
@tonerdo We need this change as this is causing incorrect reporting in dotnet/machinelearning repo. I will appreciate if you can approve this soon and release a nuget. |
@tonerdo Sorry, I built and ran tests within VS but forgot to run the tests again after a command line build. I'll fix the build issues and update this PR. |
I'm corious, do you check threshold also of test module? |
Codecov Report
@@ Coverage Diff @@
## master #318 +/- ##
==========================================
+ Coverage 87.5% 88.38% +0.88%
==========================================
Files 16 31 +15
Lines 2041 3066 +1025
==========================================
+ Hits 1786 2710 +924
- Misses 255 356 +101 |
@MarcoRossignoli The intent was to remove all hard-coded special handling of test modules. This is the responsibility of downstream operations, not the core instrumentation. Test modules can still be excluded from instrumentation using existing Coverlet features. |
I agree, maybe there was a real sample, only curiosity |
Why would you instrument a test assembly? |
@ViktorHofer coverage of test assemblies has the same advantages as coverage of production assemblies for the purpose of guided code review (which is by far the most valuable feature of code review tooling). Having worked with a wide variety of coverage tools, developer policies, and management policies over the years, coverage of test assemblies has become a fundamental requirement of code coverage tools for me on all projects. |
I'm not opposed to the feature but I don't like the breaking change. |
@ViktorHofer It's not a breaking change so much as a bug fix. The current release fails to instrument the named input assembly to the instrumentation request. It does not exclude test code specifically (e.g. test helper assemblies referenced by the unit test assembly), leading to reports that contain incomplete information about tests. |
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.
@tonerdo code LGTM to me
BTW I understand @ViktorHofer's concern, you've more experience on breaking changes on coverlet, maybe you can evaluate better the consequences.
* Revert "exclude test folder from codecov. (#2227)" This reverts commit eed91b9. * Use a fake target path to avoid coverlet-coverage/coverlet#318 * Manually apply codecov flags through multiple uploads Eventually codecov.io should support the automatic application of flags based on directory structure. In the meantime, upload the coverage report twice and allow the server to filter and apply the desired flags. * Show production code numbers when coverage is reported
I don't think this is a breaking change. All this will do is include the test assembly coverage in the final coverage output. Basically like when I added support for embedded PDBs and xunit assemblies started showing up in the results. I wonder if we should put this behind a flag ( Thoughts? @MarcoRossignoli @ViktorHofer @sharwell |
The main problem with |
Personally I wouldn't add another flag, @sharwell sample is pertinent, this is slight change in behaviour, should be advertised(on release note), with this change coverlet will be more useful(#318 (comment)) add test assembly exclusion to scripts doesn't seem a great problem, if this will break something...well we'll fix it. I'd like to listen @ViktorHofer's final words...good opinions are never enough. |
I agree with others that we shouldn't introduce an option for that but definitely outline it in the release notes. Giving it a second thought I agree with Sam that the current behavior is the broken one and this change is mere a fix to it. |
Filtering of test modules is a per-project policy applied during report creation. It should not be assumed or applied as a default configuration.
Users who rely on the current behavior for performance reasons may exclude the test modules via instrumentation properties, though this might not be required since other recent performance improvements in coverlet would be adopted at the same time an upgrade caused this change to take effect.