[prev in list] [next in list] [prev in thread] [next in thread] 

List:       olpc-sugar
Subject:    [Sugar-devel] Measuring coverage of Python activities
From:       James Cameron <quozl () laptop ! org>
Date:       2018-05-15 0:58:36
Message-ID: 20180515005836.GH17262 () us ! netrek ! org
[Download RAW message or body]

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.

https://github.com/sugarlabs/sugar-docs/blob/master/src/python-coverage-guide.md

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,

```
python-coverage html
```

* 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.

-- 
James Cameron
http://quozl.netrek.org/
_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic