fix test coverage report

"tox -e cover" will now correctly generate
the coverage report.

Change-Id: Ic755962220661f854d99f64bd8b22a6ff99cc95b
Closes-bug: 1464093
This commit is contained in:
Ivar Lazzaro 2015-06-10 21:27:14 -07:00
parent 6cf6b03125
commit 6a1be62aa4
4 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,7 @@
[run]
branch = True
source = gbp
omit = gbp/tests/*,gbp/openstack/*
source = gbpservice
omit = gbpservice/tests/*,gbpservice/neutron/tests/*,gbpservice/neutron/db/migration/*
[report]
ignore-errors = True

2
.gitignore vendored
View File

@ -28,6 +28,8 @@ pip-log.txt
nosetests.xml
.testrepository
subunit.log
covhtml
cover
# Translations
*.mo

View File

@ -121,7 +121,7 @@ function run_tests {
fi
if [ $coverage -eq 1 ]; then
TESTRTESTS="$TESTRTESTS --coverage"
TESTRTESTS="$TESTRTESTS --coverage --coverage-package-name gbpservice"
else
TESTRTESTS="$TESTRTESTS --slowest"
fi
@ -147,7 +147,7 @@ function run_tests {
echo "Generating coverage report in covhtml/"
# Don't compute coverage for common code, which is tested elsewhere
${wrapper} coverage combine
${wrapper} coverage html --include='gbpservice/*' --omit='gbpservice/openstack/common/*' -d covhtml -i
${wrapper} coverage html --include='gbpservice/*' -d covhtml -i
fi
return $RESULT

View File

@ -45,11 +45,15 @@ commands =
gbp-db-manage check_migration
[testenv:i18n]
commands = python ./tools/check_i18n.py ./neutron ./tools/i18n_cfg.py
commands =
python ./tools/check_i18n.py ./neutron ./tools/i18n_cfg.py
[testenv:cover]
commands =
python setup.py testr --coverage --testr-args='{posargs}'
coverage erase
python setup.py testr --coverage --coverage-package-name gbpservice --testr-args='{posargs}'
coverage combine
coverage html --include='gbpservice/*' -d covhtml -i
[testenv:venv]
commands = {posargs}