aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-horizon/horizon-fix-test-script-to-not-require-coverage-tool.patch
blob: 83ac9a49ccf15161d8521442d8d174cb555036bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 7f9d9b9d5f5621f00ba1a425307de0c242fc3453 Mon Sep 17 00:00:00 2001
From: Keith Holman <Keith.Holman@windriver.com>
Date: Fri, 30 May 2014 11:40:39 -0400
Subject: [PATCH] horizon: fix test script to not require coverage tool

Horizon provides a run_tests.sh script for testing the
functionality of the installation of the product in the target
environment.  The script contains a "-c" option to allow code
coverage testing using the "coverage" tool.  However, the
script currently still calls the tool even if the option is not
given.  This fix removes the dependency on the "coverage"
command if the "-c" option is not passed to the script.

Signed-off-by: Keith Holman <Keith.Holman@windriver.com>
---
 run_tests.sh | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh
index 5993c81..a297cd9 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -298,8 +298,12 @@ function run_tests_all {
   if [ "$NOSE_WITH_HTML_OUTPUT" = '1' ]; then
     export NOSE_HTML_OUT_FILE='horizon_nose_results.html'
   fi
-  ${command_wrapper} coverage erase
-  ${command_wrapper} coverage run -p $root/manage.py test horizon --settings=horizon.test.settings $testopts
+  if [ $with_coverage -eq 1 ]; then
+    ${command_wrapper} coverage erase
+    ${command_wrapper} coverage run -p $root/manage.py test horizon --settings=horizon.test.settings $testopts
+  else
+    ${command_wrapper} python $root/manage.py test horizon --settings=horizon.test.settings $testopts
+  fi
   # get results of the Horizon tests
   HORIZON_RESULT=$?
 
@@ -308,7 +312,11 @@ function run_tests_all {
   if [ "$NOSE_WITH_HTML_OUTPUT" = '1' ]; then
     export NOSE_HTML_OUT_FILE='dashboard_nose_results.html'
   fi
-  ${command_wrapper} coverage run -p $root/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings $testopts
+  if [ $with_coverage -eq 1 ]; then
+    ${command_wrapper} coverage run -p $root/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings $testopts
+  else
+    ${command_wrapper} python $root/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings $testopts
+  fi
   # get results of the openstack_dashboard tests
   DASHBOARD_RESULT=$?
 
@@ -317,9 +325,9 @@ function run_tests_all {
     ${command_wrapper} coverage combine
     ${command_wrapper} coverage xml -i --omit='/usr*,setup.py,*egg*,.venv/*'
     ${command_wrapper} coverage html -i --omit='/usr*,setup.py,*egg*,.venv/*' -d reports
+    # Remove the leftover coverage files from the -p flag earlier.
+    rm -f .coverage.*
   fi
-  # Remove the leftover coverage files from the -p flag earlier.
-  rm -f .coverage.*
 
   if [ $(($HORIZON_RESULT || $DASHBOARD_RESULT)) -eq 0 ]; then
     echo "Tests completed successfully."
-- 
1.9.3