Here is an example script:
def myiter():
for i in range(10):
yield i
for i in myiter():
break
print "foo"
Now, if I try to trace it:
$ python -m trace --trace --count test.py
--- modulename: threading, funcname: settrace
threading.py(70): _trace_hook = func
--- modulename: test, funcname: <module>
test.py(1): def myiter():
test.py(5): for i in myiter():
--- modulename: test, funcname: myiter
test.py(2): for i in range(10):
test.py(3): yield i
test.py(6): break
c:\python25\lib\ntpath.py:190: RuntimeWarning:
tp_compare didn't return -1 or -2 for exception
if i<=max(p.rfind('/'), p.rfind('\\')):
foo
It stops tracing after the `break` statement. The line
after, `print "foo"`, is not traced nor included in the
coverage output.
I'm not sure RuntimeWarning from ntpath.py is relevant
here, because if I use the trace module in some other
situation it doesn't print it. IMO, it's just a side
effect of some different problem.
|