summaryrefslogtreecommitdiffstats
path: root/testapi/run_test.sh
blob: 4efc7af3b29be09e873568c39c027b749ff13b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

set -o errexit

# Get script directory
SCRIPTDIR=`dirname $0`

echo "Running unit tests..."

# Creating virtual environment
virtualenv $SCRIPTDIR/testapi_venv
source $SCRIPTDIR/testapi_venv/bin/activate

# Install requirements
pip install -r $SCRIPTDIR/requirements.txt
pip install coverage
pip install nose>=1.3.1
pip install pytest
pip install mock

find . -type f -name "*.pyc" -delete

nosetests --with-xunit \
    --with-coverage \
    --cover-erase \
    --cover-package=$SCRIPTDIR/opnfv_testapi/cmd \
    --cover-package=$SCRIPTDIR/opnfv_testapi/common \
    --cover-package=$SCRIPTDIR/opnfv_testapi/resources \
    --cover-package=$SCRIPTDIR/opnfv_testapi/router \
    --cover-xml \
    --cover-html \
    $SCRIPTDIR/opnfv_testapi/tests

exit_code=$?

deactivate

exit $exit_code