From 44cd454dbd517874ceabb58a7c7d13650627ae0b Mon Sep 17 00:00:00 2001 From: Debayan Ray Date: Tue, 28 Feb 2017 01:10:44 -0500 Subject: [PATCH] Refining test coverage This patch excludes the test artifacts from coverage results. It uses coverage lib, already included in test-requirements, to put the coverage results in 'cover' folder and displays the report as well as part of tox `cover` target. Change-Id: Ib6dd8558dc5db4025b27c660690d0c31fd983367 --- .coveragerc | 3 +++ tox.ini | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index 1621b042..3532cb58 100644 --- a/.coveragerc +++ b/.coveragerc @@ -4,3 +4,6 @@ source = sushy [report] ignore_errors = True + +[html] +directory = cover diff --git a/tox.ini b/tox.ini index fb709ff5..c8f1aee3 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,13 @@ commands = flake8 {posargs} commands = {posargs} [testenv:cover] -commands = python setup.py test --coverage --testr-args='{posargs}' +# After running this target, visit sushy/cover/index.html +# in your browser, to see a nicer presentation report with annotated +# HTML listings detailing missed lines. +commands = coverage erase + python setup.py test --coverage --testr-args='{posargs}' + coverage report --omit=*test* + coverage html --omit=*test* [testenv:docs] commands = python setup.py build_sphinx