-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
Feature Request - Function and class coverage in "coverage report" #1859
Comments
I have an old branch that adds something like this: master...devdanzin:coveragepy:report_on_regions. There's a sample of what it outputs (or used to, not sure it's working after recent refactorings) in issue #1793 (where it was decided to not add this information to the textual report then). I won't be able to work on it for a couple of weeks, but would be glad to polish and update it if it's deemed desirable. Feel free to adapt it and submit as a PR before I'm back if you want to (and @nedbat agrees, of course). |
@devdanzin
I'm a Python developer myself, but I'm not familiar with the I bet it will be way faster to wait for somebody else to add this feature! I'll keep using my workaround until then! |
Good news: I've merged master into my branch and it works as-is. If you can, please install coverage from that branch and check whether it does everything you want, the way you'd like it to. I'm open to changing the output format and other features to better suit your needs. For this to land as an official feature, besides being approved by the maintainer, it would still need some tests and some cleanup (mostly to mirror the cleaner code organization in jsonreport.py). I should be able to work on this during the weekend. |
@devdanzin I'll try to find two hours to setup a temp devcontainer and try it out. How can I install your updated version of coverage.py? Does In the meanwhile, I do provide to you a first quick answer! I would expect your feature to output a formatted table like the one that I get from my latest workaround: The screenshot comes from the following project: nwreadinglist. My latest workaround works by installing Pandoc in the dev environment (devcontainer):
and asking it to format the table I extract from
|
I tested and
Currently output for
|
@devdanzin
As far as there is the class name and the coverage % in a formatted table, it's good enough to quickly add tests where required! Thank you for your work so far! I'll update this thread once I try it out! |
Problem
As stated in this thread, function and class coverage has been added in
coverage v7.5.0
!Thank you @nedbat for this game-changer feature!
The problem is that it requires to open two HTML files ("class_index.html" and "function_index.html") in a browser at each run of
coverage html
, which doesn't suit terminal-based CI/CD pipelines and workflows.Feature Request
I kindly request, if possible, to have the same content of "class_index.html" and "function_index.html" as output of the
coverage report
command? - i.e:Current Workaround
The very inelegant workaround I'm using at the moment on my Debian 12-based devcontainer is the following one:
coverage
(>= 7.5.0):html2text
:tests
folders:A
htmlcov
sub-folder is created, containing the two HTML files we need ("class_index.html" and "function_index.html").Extract and format the table from the HTML file(s):
As you can imagine, it's not the most practical solution.
The text was updated successfully, but these errors were encountered: