3 ##############################################################################
4 # Copyright (c) 2015 Ericsson AB and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 # Run yardstick's flake8, unit, coverage, functional test
14 getopts ":f" FILE_OPTION
16 # don't write .pyc files this can cause odd unittest results
17 export PYTHONDONTWRITEBYTECODE=1
19 PY_VER="py$( python --version | sed 's/[^[:digit:]]//g' | cut -c-2 )"
22 COVER_DIR_NAME="./tests/ci/"
26 echo "Get external libs needed for unit test"
28 echo "Running unittest ... "
29 if [ $FILE_OPTION == "f" ]; then
30 python -m unittest discover -v -s tests/unit > $logfile 2>&1
32 python -m unittest discover -v -s tests/unit
36 if [ $FILE_OPTION == "f" ]; then
37 echo "FAILED, results in $logfile"
41 if [ $FILE_OPTION == "f" ]; then
42 echo "OK, results in $logfile"
48 # don't re-run coverage on both py27 py3, it takes too long
49 if [[ -z $SKIP_COVERAGE ]] ; then
50 source $COVER_DIR_NAME/cover.sh
55 run_functional_test() {
57 mkdir -p .testrepository
58 python -m subunit.run discover tests/functional > .testrepository/subunit.log
60 subunit2pyunit < .testrepository/subunit.log
62 subunit-stats < .testrepository/subunit.log
64 if [ $EXIT_CODE -ne 0 ]; then