-
-
Notifications
You must be signed in to change notification settings - Fork 464
Open
Labels
bugSomething isn't workingSomething isn't workinggood firstThis could be a good first contributionThis could be a good first contribution
Description
Describe the bug
the coverage data of docstring in coverage.json is different with other reports.
To Reproduce
- Run test and generate different reports
# cat test.py
01
02 '''
03 global docstring
04 '''
05
06 def add(a, b):
07 '''
08 this is docstring for "add"
09 '''
10 return a + b
11
12 print(add(2,7))
# coverage run test.py
# coverage json
# coverage html
# coverage lcov
# coverage xml- Compare the reports
=== coverage.json
the executed lines are like:
"executed_lines": [2, 6, 10, 12 ]
which marks line 2 (global docstring) as executed. Notice line 7 is not marked as executed though it's also a docstring.
=== html report
It doesn't mark line 2 as executed.
=== coverage.lcov
It doesn't mark line 2 as executed.
# cat coverage.lcov
1 SF:test.py
2 DA:6,1
3 DA:10,1
4 DA:12,1
5 LF:3
6 LH:3
7 FN:6,10,add
8 FNDA:1,add
9 FNF:1
10 FNH:1
11 end_of_record
=== coverage.xml
It doesn't mark line 2 as executed.
# cat coverage.xml
...
<lines>
<line number="6" hits="1"/>
<line number="10" hits="1"/>
<line number="12" hits="1"/>
</lines>
...
Answer the questions below:
- What version of Python are you using?
Python 3.14.2 - What version of coverage.py shows the problem? The output of
coverage debug sysis helpful.
coverage_version: 7.13.0
Expected behavior
The coverage data of executed_lines should be consistent between JSON report and other reports.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood firstThis could be a good first contributionThis could be a good first contribution