]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix running unit tests with coverage
authorgit-harry <git-harry@live.co.uk>
Tue, 2 Sep 2014 12:04:06 +0000 (13:04 +0100)
committergit-harry <git-harry@live.co.uk>
Tue, 2 Sep 2014 12:04:06 +0000 (13:04 +0100)
The path to this repo is added to PYTHONPATH when the coverage flag is
specified so that the cinder entry points are discovered.

Change-Id: Ie33a63c6ecd443b900fa7bed3a1ec5b6bb0065e6
Closes-Bug: #1364347

run_tests.sh

index bc88a8aaae9b58bcc4a2ba5bf46ccc8da308adb3..bf43508497ba121840bd98860969c3f1dcfa6cf0 100755 (executable)
@@ -132,6 +132,11 @@ function run_tests {
 
   if [ $coverage -eq 1 ]; then
     TESTRTESTS="$TESTRTESTS --coverage"
+    if [ -z "${PYTHONPATH:-}" ]; then
+        export PYTHONPATH=./
+    else
+        export PYTHONPATH=$PYTHONPATH:./
+    fi
   else
     TESTRTESTS="$TESTRTESTS"
   fi