make unittest cover server.py in TestAPI
[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 pip install pytest
19 pip install mock
20
21 find . -type f -name "*.pyc" -delete
22
23 nosetests --with-xunit \
24     --with-coverage \
25     --cover-erase \
26     --cover-package=$SCRIPTDIR/opnfv_testapi/cmd \
27     --cover-package=$SCRIPTDIR/opnfv_testapi/common \
28     --cover-package=$SCRIPTDIR/opnfv_testapi/resources \
29     --cover-package=$SCRIPTDIR/opnfv_testapi/router \
30     --cover-xml \
31     --cover-html \
32     $SCRIPTDIR/opnfv_testapi/tests
33
34 exit_code=$?
35
36 deactivate
37
38 exit $exit_code