Merge "[FUNCTEST] Correct right ip is used for public endpoint"
[functest.git] / run_unit_tests.sh
1 #!/bin/bash
2 set -o errexit
3 set -o pipefail
4
5 # Either Workspace is set (CI)
6 if [ -z $WORKSPACE ]
7 then
8     WORKSPACE="."
9 fi
10
11
12 # ***************
13 # Run unit tests
14 # ***************
15 echo "Running unit tests..."
16
17 # start vitual env
18 virtualenv $WORKSPACE/functest_venv
19 source $WORKSPACE/functest_venv/bin/activate
20
21 # install python packages
22 sudo apt-get install -y build-essential python-dev python-pip
23 pip install --upgrade pip
24 pip install -r $WORKSPACE/test-requirements.txt
25 pip install $WORKSPACE
26
27 export CONFIG_FUNCTEST_YAML=$(pwd)/functest/ci/config_functest.yaml
28 # unit tests
29 # TODO: remove cover-erase
30 # To be deleted when all functest packages will be listed
31 nosetests --with-xunit \
32          --with-coverage \
33          --cover-erase \
34          --cover-tests \
35          --cover-package=functest.cli \
36          --cover-package=functest.core.testcase_base \
37          --cover-package=functest.opnfv_tests.sdn.odl.odl \
38          --cover-package=functest.utils \
39          --cover-xml \
40          --cover-html \
41          functest/tests/unit
42 rc=$?
43
44 deactivate
45
46 exit $rc