#!/bin/bash
#set -eux # for debug only
set -eu

SMROOT=$(cd $(dirname $0) && cd .. && pwd)

if  [ ! -x "$(command -v nosetests)" ] || [ ! -x "$(command -v coverage)" ]; then
    echo "Activating virtual env"

    ENVDIR="$SMROOT/.env"

    if [ ! -d $ENVDIR ]; then
        $(dirname $0)/setup_env_for_python_unittests.sh
    fi

    set +u
    . "$ENVDIR/bin/activate"
    set -u
fi

(
    cd "$SMROOT"
    PYTHONPATH="$SMROOT/tests/mocks:$SMROOT/drivers/" \
        coverage run --branch $(which nosetests) \
            --with-xunit \
            --xunit-file=nosetests.xml \
            tests

    for format in xml html report; do
        coverage $format --include="$SMROOT/*" --omit="$SMROOT/.env/*,tests/mocks/*"
    done
)

#!/bin/bash
#set -eux # for debug only
set -eu

SMROOT=$(cd $(dirname $0) && cd .. && pwd)

if  [ ! -x "$(command -v nosetests)" ] || [ ! -x "$(command -v coverage)" ]; then
    echo "Activating virtual env"

    ENVDIR="$SMROOT/.env"

    if [ ! -d $ENVDIR ]; then
        $(dirname $0)/setup_env_for_python_unittests.sh
    fi

    set +u
    . "$ENVDIR/bin/activate"
    set -u
fi

(
    cd "$SMROOT"
    PYTHONPATH="$SMROOT/tests/mocks:$SMROOT/drivers/" \
        coverage run --branch \
            --source="$SMROOT/drivers,$SMROOT/tests" \
            $(which nosetests) \
            --with-xunit \
            --xunit-file=nosetests.xml \
            tests

    for format in xml html report; do
        coverage $format --include="$SMROOT/*" --omit="$SMROOT/.env/*,$SMROOT/tests/mocks/*"
    done
)

Add source parameter to coverage so that all source files are considered
Add source parameter to coverage so that all source files are considered

Signed-off-by: Mark Syms <655512b2a8f1aba6e4085462b623575da824f038@citrix.com>
Reviewed-by: Chandrika Srinivasan <51ae5eeda27fe08017d2d63c87755f0707891830@citrix.com>
