From 58581ce92c403e0744766d1a8232aa248e33dda0 Mon Sep 17 00:00:00 2001 From: JUN JIE NAN Date: Fri, 24 Jan 2014 23:54:09 +0800 Subject: [PATCH] Enabled source code coverage for contrib directory So we can check the source code coverage status of contrib directory. It's obvious to adjust omit and source properties in .coveragerc. The tricky code in .testr.conf is caused by the behavior of setuptools. When running coverage, setuptools set environment variable PYTHON to 'coverage run --source package --parallel-mode' and call testr to run the tests. The value specified via command line option --source will overwrite the source value in .coveragerc. So contrib directory is excluded from coverage run. The change in .testr.conf removed the '--source heat' specified by setuptools. So the source value specified in .coveragerc will be used by coverage. Change-Id: I92f6b058067ace3b3370a3670856ab3dc073b52f --- .coveragerc | 4 ++-- .testr.conf | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.coveragerc b/.coveragerc index 88cb660bbb..4625b8853f 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,7 @@ [run] branch = True -source = heat -omit = heat/tests/*,heat/openstack/* +source = heat,contrib +omit = */tests/*,heat/openstack/* [report] ignore-errors = True diff --git a/.testr.conf b/.testr.conf index fd6e92bee2..77a8e1bd95 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,6 +1,7 @@ [DEFAULT] test_command= - ${PYTHON:-python} -m subunit.run discover -s . $LISTOPT $IDOPTION - ${PYTHON:-python} -m subunit.run discover -s contrib $LISTOPT $IDOPTION + PYTHON=$(echo ${PYTHON:-python} | sed 's/--source heat//g') + ${PYTHON} -m subunit.run discover -s . $LISTOPT $IDOPTION + ${PYTHON} -m subunit.run discover -s contrib $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list