51db09f65fbdca7f28ea882cde62de3261046b75
[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 virtualenv $SCRIPTDIR/testapi_venv
12 source $SCRIPTDIR/testapi_venv/bin/activate
13
14 # Install requirements
15 pip install -r $SCRIPTDIR/requirements.txt
16 pip install coverage
17 pip install nose>=1.3.1
18
19 find . -type f -name "*.pyc" -delete
20
21 nosetests --with-xunit \
22     --with-coverage \
23     --cover-erase \
24     --cover-package=$SCRIPTDIR/opnfv_testapi/cmd \
25     --cover-package=$SCRIPTDIR/opnfv_testapi/common \
26     --cover-package=$SCRIPTDIR/opnfv_testapi/resources \
27     --cover-package=$SCRIPTDIR/opnfv_testapi/router \
28     --cover-xml \
29     --cover-html \
30     $SCRIPTDIR/opnfv_testapi/tests
31
32 exit_code=$?
33
34 deactivate
35
36 exit $exit_code