Message6532
I've been trying to measure coverage of my Jython program and finding
that (at least) all lines containing "try:", "except:" or "break"
never get shown as covered.
This appears to be because the sys.settrace function, on which
coverage.py relies for its information, is not triggered by such
lines.
For example, compare the output of the following program under Jython
and CPython. No output is created for lines 10, 12 or 13 when running
under Jython, whereas it is for CPython.
import sys
def tracefunc(frame, event, arg):
print "Trace", event, frame.f_lineno
return tracefunc
def do():
x = [ 1 ]
for i in range(2):
try:
x[i]
except IndexError:
break
sys.settrace(tracefunc)
do() |
|
Date |
User |
Action |
Args |
2011-05-30 18:52:20 | geoffbache | set | recipients:
+ geoffbache |
2011-05-30 18:52:20 | geoffbache | set | messageid: <1306781540.43.0.985500138857.issue1751@psf.upfronthosting.co.za> |
2011-05-30 18:52:20 | geoffbache | link | issue1751 messages |
2011-05-30 18:52:19 | geoffbache | create | |
|