test.sh
author Tero Marttila <terom@paivola.fi>
Sat, 07 Mar 2015 13:41:18 +0200
changeset 730 2073e2e20895
parent 689 c258e3ff6d32
permissions -rwxr-xr-x
lib/pvl/service: use full /usr/sbin/service path, since debian does not have sbin on user $PATH
COVERAGE=opt/bin/coverage
DOCTEST=(
    pvl/dhcp/config.py
    pvl/dns/serial.py
    pvl/dns/labels.py
    pvl/dns/reverse.py
    pvl/dns/generate.py
    pvl/hosts/host.py
)

UNITTEST=(
    pvl.dhcp.tests
    pvl.dns.tests
    pvl.hosts.tests
)

coverage() {
    echo "$ $FUNCNAME $@" >&2

    $COVERAGE "$@"
}

coverage erase

for import in ${UNITTEST[@]}; do
    coverage run -a -m unittest $import
done

for py in ${DOCTEST[@]}; do
    coverage run -a -m doctest $py
done

coverage html \
    --include=pvl/dhcp/*.py,pvl/dns/*.py,pvl/hosts/*.py