[TIP] Coverage of application which doesn't end by itself

Li, Xiaoyan xiaoyan.li at intel.com
Wed Jun 15 20:38:44 PDT 2016


Hi,


I would like to use coverage to check code coverage of applications which is not like unit tests which terminate after running.

For example, I use "coverage run test.py" to check code coverage of following file. 

test.py
while i<4:
    time.sleep(1)
    print "again"
    i=i+2

As above process will not end by itself, I run "kill <process_id> to end it.

But the problem is that coverage can't generate data file. 

Anyone kindly gives me any suggestions how to check code coverage like above test.py? 

Best wishes
Lisa





More information about the testing-in-python mailing list