From 56bab01427a005aa59a69dd42c169da4db1cdd27 Mon Sep 17 00:00:00 2001 From: Debayan Ray Date: Thu, 17 Mar 2016 03:53:50 -0700 Subject: [PATCH] Adds test coverage in tox.ini Coverage measurement will be helpful to gauge the effectiveness of tests and maintain the quality of the code. Also changing .gitignore to ignore the cover directory and .coverage directories. Change-Id: I184210af2d2e677b7cc2fe0c6561334ebc444fad --- .gitignore | 3 +++ test-requirements.txt | 1 + tox.ini | 13 ++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6401b540..c1f411fe 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports +cover/ +.coverage* +!.coveragerc htmlcov/ .tox/ .coverage diff --git a/test-requirements.txt b/test-requirements.txt index 40087a7e..8e77bdfd 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,6 @@ mock hacking>=0.9.2,<0.10 +coverage>=3.6 # Apache-2.0 testrepository>=0.0.18 testtools>=1.4.0 # MIT os-testr>=0.4.1 # Apache-2.0 diff --git a/tox.ini b/tox.ini index a864a6d9..2524ea98 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py34,py27,pep8 +envlist = py34,py27,pep8,cover [testenv] usedevelop = True @@ -20,6 +20,17 @@ deps = commands = flake8 proliantutils +[testenv:cover] +# After running this target, visit proliantutils/htmlcov/index.html +# in your browser, to see a nicer presentation report with annotated +# HTML listings detailing missed lines. +basepython = python2.7 +deps = {[testenv]deps} +commands = coverage erase + python setup.py testr --coverage --testr-args='{posargs}' + coverage report --omit=*test* + coverage html --omit=*test* + [flake8] max-complexity=15