Merge "Added unit tests for utils/openstack_utils.py"
[functest.git] / run_unit_tests.sh
index a8ce54c..79d05d3 100755 (executable)
@@ -2,28 +2,6 @@
 set -o errexit
 set -o pipefail
 
-# ******************************
-# prepare the env for the tests
-# ******************************
-# clean useless results dir
-# should be done at the end
-# but in case of crash during unit test
-# clean it anyway
-if [ -d "/home/opnfv/functest/results" ]
-then
-    sudo rm -rf /home/opnfv/functest
-fi
-
-# TODO clean that...
-# Create log dir if needed
-# log shall be disabled during unit tests
-# fix to be done in Logger
-echo "Create dummy log file...."
-sudo mkdir -p /home/opnfv/functest/results/odl
-sudo touch /home/opnfv/functest/results/functest.log
-sudo touch /home/opnfv/functest/results/odl/stdout.txt
-sudo chmod -Rf a+rw /home/opnfv
-
 # Either Workspace is set (CI)
 if [ -z $WORKSPACE ]
 then
@@ -41,12 +19,10 @@ virtualenv $WORKSPACE/functest_venv
 source $WORKSPACE/functest_venv/bin/activate
 
 # install python packages
-easy_install -U setuptools
-easy_install -U pip
-pip install -r $WORKSPACE/requirements.txt
-pip install -e $WORKSPACE
-
-python $WORKSPACE/setup.py develop
+sudo apt-get install -y build-essential python-dev python-pip
+pip install --upgrade pip
+pip install -r $WORKSPACE/test-requirements.txt
+pip install $WORKSPACE
 
 export CONFIG_FUNCTEST_YAML=$(pwd)/functest/ci/config_functest.yaml
 # unit tests
@@ -55,8 +31,11 @@ export CONFIG_FUNCTEST_YAML=$(pwd)/functest/ci/config_functest.yaml
 nosetests --with-xunit \
          --with-coverage \
          --cover-erase \
-         --cover-package=functest.core.TestCasesBase \
+         --cover-tests \
+         --cover-package=functest.cli \
+         --cover-package=functest.core.testcase_base \
          --cover-package=functest.opnfv_tests.sdn.odl.odl \
+         --cover-package=functest.utils \
          --cover-xml \
          --cover-html \
          functest/tests/unit
@@ -64,13 +43,4 @@ rc=$?
 
 deactivate
 
-# *******
-# clean
-# *******
-# Clean useless logs
-if [ -d "/home/opnfv/functest/results" ]
-then
-    sudo rm -rf /home/opnfv/functest/results
-fi
-
 exit $rc