Merge "Compass4NFV add new scenario nosdn-kvm"
[releng.git] / utils / test / testapi / run_test.sh
1 #!/bin/bash
2
3 set -o errexit
4
5 # Get script directory
6 SCRIPTDIR=`dirname $0`
7
8 echo "Running unit tests..."
9
10 # Creating virtual environment
11 if [ ! -z $VIRTUAL_ENV ]; then
12     venv=$VIRTUAL_ENV
13 else
14     venv=$SCRIPTDIR/.venv
15     virtualenv $venv
16 fi
17 source $venv/bin/activate
18
19 # Install requirements
20 pip install -r $SCRIPTDIR/requirements.txt
21 pip install -r $SCRIPTDIR/test-requirements.txt
22
23 find . -type f -name "*.pyc" -delete
24
25 nosetests --with-xunit \
26     --with-coverage \
27     --cover-erase \
28     --cover-package=$SCRIPTDIR/opnfv_testapi/cmd \
29     --cover-package=$SCRIPTDIR/opnfv_testapi/common \
30     --cover-package=$SCRIPTDIR/opnfv_testapi/resources \
31     --cover-package=$SCRIPTDIR/opnfv_testapi/router \
32     --cover-xml \
33     --cover-html \
34     $SCRIPTDIR/opnfv_testapi/tests
35
36 exit_code=$?
37
38 deactivate
39
40 exit $exit_code