Reputation: 25812
I am using Jenkins to build and monitor the testing for my application.
I have such a piece of python code:
def register_os_handler():
def handler(signal, frm):
raise SystemExit()
signal(SIGHUP, handler)
In my test, I create a subprocess, and send it a SIGHUP signal and it quits as expected, which means it reaches the line of raise SystemExit()
.
When I submit it to Jenkins, all tests passed, but it says the line raise SystemExit()
is not covered.
I feel curious that why that line was indeed reached, but still Jenkins complains?
How does the Jenkins' coverage report work?
If a process (even if it is a subprocess) quits, it cannot detect the line or take the line into account?
How to get around this?
Upvotes: 3
Views: 1807
Reputation: 2046
I believe Jenkins uses coverage.py. If you want to compute coverage for subprocess, you need a little hack, which is described here:
http://nedbatchelder.com/code/coverage/subprocess.html
Upvotes: 1