Automatically combine coverage in report#2162
Conversation
| if options.no_combine: | ||
| self.coverage.load() | ||
| else: | ||
| self.coverage.load() |
There was a problem hiding this comment.
Kind of disappointed Claude didn't factor this out!
|
I went this route because if coverage is already combined, coverage report
coverage combine
coverage reportbut this is the least invasive way (it only changes the behavior of that first |
|
Sorry, which route? I'm missing something: with this code it's an error to combine if it's already been combined? |
|
The choices for fixing this were:
I chose the third option (the "route I went"), because it's the most helpful one that won't break someone's workflow if they already correctly use For example: If I made |
|
I see, thanks. Quickly reading the code, I had missed that the combined data was not written out. My only concern with combining but not saving is that |
|
I think we can do without |
This does not modify the state on disk, but one common newbie error is doing `coverage run ...` followed by `coverage report` which shows some, but not the true coverage. Default to doing the combine, but allow people to pass `--no-combine` if this breaks their workflows. Fixes coveragepy#1781
09c6db5 to
6cf5c84
Compare
|
Done, PTAL |
|
We have a problem. If the test cycle is I think it will be error-prone for these files to hang around, so we should re-consider having the implicit combine keep the data files. What would be bad about the implicit combine deleting the parallel files? Doing that would also mean that |
|
I'm making the change to remove the data files during the implicit combine. |
|
This is now released as part of coverage 7.14.0. |
|
Hi, this is a very sensible feature, but guess what: it breaks our workflow! (Please let me know if you'd rather I opened this as a separate ticket.) We currently run tests over several modules and report them separately. Then we report the combined coverage over all modules, i.e. cd modules/one
coverage run --parallel-mode
coverage combine --keep
coverage report --fail-under=80
# Files:
# modules/one/.coverage
# modules/one/.coverage.abc
# modules/one/.coverage.def
cd ../two
coverage run --parallel-mode
coverage combine --keep
coverage report --fail-under=80
# Files:
# modules/two/.coverage
# modules/two/.coverage.ghi
# modules/two/.coverage.jkland then: coverage combine modules/*
coverage reportwill combine the I can see the logic on combining for a report, as it saves a step in the majority of cases, but it's also less flexible. I've had to rollback to 7.13.5 for now, as copying the files first is more file management than I'd like (given that it worked before). I can think of a few solutions:
Option 2 would allow us to skip our first |
This does not modify the state on disk, but one common newbie error is
doing
coverage run ...followed bycoverage reportwhich shows some,but not the true coverage.
Default to doing the combine, but allow people to pass
--no-combineifthis breaks their workflows.
Fixes #1781