[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


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. 

while i<4:
    print "again"

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

More information about the testing-in-python mailing list