Skip to content

WIP, ENH: add docstring cov to html #808

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions coverage/config.py
Original file line number Diff line number Diff line change
@@ -206,6 +206,7 @@ def __init__(self):
self.extra_css = None
self.html_dir = "htmlcov"
self.html_title = "Coverage report"
self.html_docstr = False

# Defaults for [xml]
self.xml_output = "coverage.xml"
@@ -353,6 +354,7 @@ def from_file(self, filename, our_file):
('extra_css', 'html:extra_css'),
('html_dir', 'html:directory'),
('html_title', 'html:title'),
('html_docstr', 'html:docstring_display'),

# [xml]
('xml_output', 'xml:output'),
7 changes: 7 additions & 0 deletions coverage/html.py
Original file line number Diff line number Diff line change
@@ -252,6 +252,13 @@ def html_file(self, fr, analysis):
)
elif lineno in analysis.statements:
line_class.append(c_run)
elif self.config.html_docstr:
# count docstring line as "executed"
# doctest SKIP directives will not
# prevent a line from being marked
# as executed, but will influence
# the associated source code proper
line_class.append(c_run)

# Build the HTML for the line.
html = []