Sunday, May 5, 2013

[ Level 2 ] Coverage in Python.

$ sudo pip install coverage
$ coverage run myApp.py arg1 arg2...
$ coverage report -m
$ coverage html
$ coverage help (run) ## or coverage run --help

Commands of coverage:
    run – Run a Python program and collect execution data.
    report – Report coverage results.
    html – Produce annotated HTML listings with coverage results.
    xml – Produce an XML report with coverage results.
    annotate – Annotate source files with coverage results.
    erase – Erase previously collected coverage data.
    combine – Combine together a number of data files.
    debug – Get diagnostic information.

Ref:
http://nedbatchelder.com/code/coverage/
http://nedbatchelder.com/code/coverage/cmd.html#cmd

Wish this helps.

regards,
Stanley Huang