Add code coverage results for functional tests

Add python code coverage reporting to the functional
test runs.

Change-Id: Icccfd3029f369bf52fc148f3838357acabfa1d1c
This commit is contained in:
Steve Heyman 2016-04-04 16:12:00 -05:00
parent 586f3b3fd5
commit fdf79c9636
4 changed files with 21 additions and 3 deletions

View File

@ -0,0 +1,12 @@
[run]
branch = True
source = ../barbican
omit = ../barbican/tests/*,
../barbican/model/migration/alembic_migrations/versions/*,
../barbican/plugin/dogtag.py, ../barbican/plugin/symantec.py
[report]
ignore_errors = True
exclude_lines =
pragma: no cover
@abc.abstractmethod

View File

@ -3,7 +3,7 @@ test_command=
OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \
${PYTHON:-python} -m subunit.run discover -s ./api -t . $LISTOPT $IDOPTION
${PYTHON:-python} -m coverage run -a -m subunit.run discover -s ./api -t . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -3,8 +3,8 @@
set -o pipefail
TESTRARGS=$1
python setup.py testr --testr-args="--subunit $TESTRARGS" | subunit-trace --no-failure-debug -f
python setup.py testr --coverage --testr-args="--subunit $TESTRARGS" | subunit-trace --no-failure-debug -f
retval=$?
echo -e "\nSlowest Tests:\n"
testr slowest
exit $retval
exit $retval

View File

@ -28,6 +28,9 @@ testr run --subunit | subunit-trace --no-failure-debug -f
retval=$?
testr slowest
coverage combine
coverage report -m
# run the tests in parallel
SKIP=^\(\?\!\.\*\(ProjectQuotasPagingTestCase\|QuotaEnforcementTestCase\|ListingCAsTestCase\|ProjectCATestCase\|GlobalPreferredCATestCase\|CertificateAuthoritiesTestCase\)\)
testr init
@ -35,4 +38,7 @@ testr run $SKIP --parallel --subunit | subunit-trace --no-failure-debug -f
retval=$(($retval || $?))
testr slowest
coverage combine
coverage report -m
exit $retval