[ovirt-devel] otopi based program testing: coverage reports

Sandro Bonazzola sbonazzo at redhat.com
Fri Aug 26 11:58:33 UTC 2016


The otopi 1.6.0 package currently in ovirt-master-snapshot includes
a new feature that allows you to collect coverage reports from your
executions. In order to enable the feature you'll need to provide a
configuration file like: 8<-------------------------------------- [run]
branch = True [report] exclude_lines = # Have to re-enable the standard
pragma pragma: no cover # Don't complain about missing debug-only code: def
__repr__ if self\.debug # Don't complain if tests don't hit defensive
assertion code: raise AssertionError raise NotImplementedError # Don't
complain if non-runnable code isn't run: if 0: if __name__ == .__main__.:
ignore_errors = True 8<------------------------------------ Be sure to have
python-coverage and libselinux-python installed on your system and then
execute: OTOPI_COVERAGE=1 COVERAGE_PROCESS_START=<your config> <your
command>
where your config is the path to your config file and your command may be
engine-setup, engine-cleanup, ovirt-host-deploy, hosted-engine --deploy or
any other possible command which uses otopi framework.
In order to generate the report: coverage html -d coverage_html_report

This feature is already leveraged in otopi check-patches and check-merged
jobs: http://jenkins.ovirt.org/search/?q=otopi_master_check
More test jobs will possibly follow.

New tests to improve coverage, improvements to the coverage configuration,
suggestions, porting to other projects are welcome.


-- 
Sandro Bonazzola
Better technology. Faster innovation. Powered by community collaboration.
See how it works at redhat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20160826/1dc52171/attachment-0001.html>


More information about the Devel mailing list