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