-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
save() and html_report() prevent further metric gathering #448
Comments
Original comment by Matthew Boehm (Bitbucket: mattboehm, GitHub: mattboehm) Thanks for reporting this, I agree that this is confusing and needs to be fixed. Looking at the code, it appears that many of these functions (report, html_report, xml_report, save, combine, annotate) end up calling get_data, which resets the collector. While this side effect is documented in get_data, it's not documented in any of these other functions. As I see it, there are 3 options:
My guess is that option 3 would break other code out there, but I'll let others weigh in on this. |
Original comment by Loic Dachary (Bitbucket: dachary, GitHub: dachary) What about implicitly calling close() when html_report() & other similar functions are called ? I have a feeling this is not the right thing to do but I'm not sure. What do you think ? https://bitbucket.org/ned/coveragepy/pull-requests/106/implicitly-close-on-html_report-etc/diff |
Original comment by Loic Dachary (Bitbucket: dachary, GitHub: dachary) It has something in common with save() prevents harvesting on stop()? |
Fixed in 12ea6d45d8b8 (bb) |
This is in 4.4b1. |
Originally reported by Michael Crouch (Bitbucket: creidieki, GitHub: creidieki)
When you call coverage.save() it seems to prevent anything else from being read in, for example, html reports. For example, the following program shows 2 lines covered (the bodies of f1 and f2):
However, if you uncomment the "cov.save()" line, it only shows the body of f1() as covered -- it doesn't record the body of f2().
cov.html_report() has the same problem when it's run between f1() and f2().
I'm not sure if this behavior is intended, but the documentation of save() and html_report() don't mention it.
I encountered this behavior while trying to find a "quick and dirty" solution for finding coverage information for the server side of a client/server application. I added cov.start() to the server initialization and added cov.html_report() to an existing server call, with the plan on just making that call to write out the currently-collected coverage information.
The text was updated successfully, but these errors were encountered: