Improve coverage testing and handling

Because the unittest and pytest runners handle the gabbi test
suites and fixtures differently, testing coverage from just
the unittest side is incomplete and potentially misleading.

The changes here include:

* adding a pytest-cov tox target to do coverage from pytest
  output is in html, put into the default 'htmlcov' directory
  (the cover target's output goes into the directory 'cover')
* adding the pytest-cov module to test-requirements.txt
* adjusting both coverage tests so coverage of the tests are
  not included in the reports, just the "real" code
* adding the artifacts from these additions to .gitignore

Sadly (but goodly), the result of these changes is that gabbi's
coverage sorts are not as bigly as they should be. With the help of
these new reports we'll make gabbi's test coverage great again.
This commit is contained in:
Chris Dent 2016-12-01 10:49:55 +00:00
parent 1ea544754f
commit 3c1a4db019
4 changed files with 12 additions and 1 deletions

2
.coveragerc Normal file
View File

@ -0,0 +1,2 @@
[run]
omit = gabbi/tests/*

7
.gitignore vendored
View File

@ -10,4 +10,9 @@ AUTHORS
ChangeLog
# Generated by testrepository
.testrepository
.idea
.idea
.cache/
# coverage related
.coverage
cover/
htmlcov/

View File

@ -1,5 +1,6 @@
mock ; python_version < '3.3'
testrepository
coverage
pytest-cov
hacking
sphinx

View File

@ -44,6 +44,9 @@ commands = {toxinidir}/test-failskip.sh
[testenv:cover]
commands = python setup.py testr --coverage --testr-args="{posargs}"
[testenv:pytest-cov]
commands = py.test --cov=gabbi gabbi/tests --cov-config .coveragerc --cov-report html
[testenv:docs]
commands =
rm -rf doc/build