Merge "[macro] property logrotate"
[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 # Either Workspace is set (CI)
9 if [ -z $WORKSPACE ]
10 then
11     WORKSPACE="."
12 fi
13
14 echo "Running unit tests..."
15
16 # Creating virtual environment
17 virtualenv $WORKSPACE/testapi_venv
18 source $WORKSPACE/testapi_venv/bin/activate
19
20 # Install requirements
21 pip install -r $SCRIPTDIR/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/commonn \
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