aboutsummaryrefslogtreecommitdiffstats
path: root/run_unit_tests.sh
blob: 3eb2cda8d95610256968cd821784e540a534b47f (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
39
40
41
42
#!/bin/bash
set -o errexit
set -o pipefail

# Either Workspace is set (CI)
if [ -z $WORKSPACE ]
then
    WORKSPACE=`pwd`
fi


# ***************
# Run unit tests
# ***************
echo "Running unit tests..."

sudo apt-get install -y build-essential python-dev python-pip
sudo pip install virtualenv==15.1.0

# start vitual env
virtualenv $WORKSPACE/functest_venv
source $WORKSPACE/functest_venv/bin/activate

# install python packages
pip install --upgrade pip
pip install -r $WORKSPACE/requirements.txt
pip install -r $WORKSPACE/test-requirements.txt
pip install $WORKSPACE

nosetests --with-xunit \
         --with-coverage \
         --cover-tests \
         --cover-package=functest \
         --cover-xml \
         --cover-html \
         --log-config=$(pwd)/functest/tests/unit/test_logging.ini \
         functest/tests/unit
rc=$?

deactivate

exit $rc