Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: PYTHON-1.1
-
Component/s: Python
-
Labels:None
-
Number of attachments :
Description
Provide coverage metrics for python code.
Design
------
Pythons ecosystem offers a couple of tools for measuring code coverage, the major ones being coverage by Ned Batchelder and figleaf by C. Titus Brown. Both are independent of the way the code is run; there is no canonical way to 'run the code under coverage'. Therefore, a data-driven approach seems to be the right one: define some data format as the interface and provide a way to feed it into Sonar via the Python plugin. Cobertura XML seems to a good choice for such a format because its quite popular and is already supported by Ned's coverage package.
To create a cobertura report for a set of unit test do something like:
$ nosetests --with-coverage
$ coverage xml
implemented with: e0c6472e8855995b68ddafd0fb4fad8c858937a2