[Sugar-devel] Measuring coverage of Python activities
quozl at laptop.org
Mon May 14 20:58:36 EDT 2018
When an activity is ported to a new library or toolkit, there is often
a lingering doubt as to whether each line of code is properly tested.
We have seen many bugs raised which show testing was inadequate.
For Python activities, the Coverage package can be used.
Measuring coverage of Python activities
* install the `python-coverage` package,
* start Terminal activity inside Sugar,
* change to the directory that holds activity source code,
* run the activity like this;
python-coverage run /usr/bin/sugar-activity
* run any test scripts, such as those using `xdotool`,
* stop the activity,
* generate annotated HTML listings,
* run the SimpleHTTPServer module in a background process,
python -m SimpleHTTPServer &
* browse to http://localhost:8000/
Tested on Ubuntu 18.04 and Ubuntu 16.04.
See the [Python Coverage](https://coverage.readthedocs.io) documentation.
More information about the Sugar-devel