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] [run]
branch = True branch = True
source = gbp source = gbpservice
omit = gbp/tests/*,gbp/openstack/* omit = gbpservice/tests/*,gbpservice/neutron/tests/*,gbpservice/neutron/db/migration/*
[report] [report]
ignore-errors = True ignore-errors = True

2
.gitignore vendored
View File

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

View File

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

View File

@ -45,11 +45,15 @@ commands =
gbp-db-manage check_migration gbp-db-manage check_migration
[testenv:i18n] [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] [testenv:cover]
commands = 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] [testenv:venv]
commands = {posargs} commands = {posargs}