From b33ac74828606bf72a3ae49131838bd467cb735a Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Mon, 14 Apr 2014 16:45:26 -0400 Subject: [PATCH] Add tox "coverage" target Change-Id: I577d62e016a550ea30671837a0a426165984e982 --- .gitignore | 4 ++++ doc/source/installation.rst | 7 +++++++ requirements.txt | 2 +- test-requirements.txt | 1 + tox.ini | 7 +++++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 93b9beae3..c5c2314cf 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,7 @@ output etc/jenkins_jobs.ini dist/* doc/build/* +jenkins_jobs/versioninfo +.coverage +cover/ +jenkins-job-builder diff --git a/doc/source/installation.rst b/doc/source/installation.rst index 1db285819..9d216579d 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -34,6 +34,13 @@ every module. To run the unit tests, execute the command:: * Note: View ``tox.ini`` to run tests on other versions of Python. +Test Coverage +------------- + +To measure test coverage, execute the command:: + + tox -e cover + Configuration File ------------------ diff --git a/requirements.txt b/requirements.txt index 84e464c0b..5dbd9abcd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ PyYAML python-jenkins -pbr>=0.5.21,<1.0 +pbr>=0.8.2,<1.0 diff --git a/test-requirements.txt b/test-requirements.txt index 5546a04f4..47cd8bec7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,5 @@ hacking>=0.5.6,<0.8 +coverage>=3.6 discover fixtures python-subunit diff --git a/tox.ini b/tox.ini index e1f3d8eb0..98d3720ce 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,13 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = python setup.py testr --slowest --testr-args='{posargs}' +[testenv:cover] +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = + python setup.py test --coverage --coverage-package-name=jenkins_jobs + coverage report + [testenv:pep8] commands = flake8