Commit 054c9265 authored by Taddeus Kroes's avatar Taddeus Kroes

Added support for python coverage version 3.4.

parent 76c8962c
TESTS=$(wildcard tests/test_*.py) TESTS=$(wildcard tests/test_*.py)
COVERAGE_OUTPUT_DIR := coverage COVERAGE_OUTPUT_DIR := coverage
OMIT := --omit /usr/share/pyshared/* OMIT := /usr/share/pyshared/*,/usr/lib/pymodules/python2.7/sympy/*
ifeq ($(findstring python-coverage,$(wildcard /usr/bin/*)), python-coverage) ifeq ($(findstring python-coverage,$(wildcard /usr/bin/*)), python-coverage)
COVERAGE=/usr/bin/python-coverage COVERAGE=/usr/bin/python-coverage
RM=rm -rf
else else
COVERAGE=/usr/bin/coverage COVERAGE=/usr/bin/coverage
endif endif
...@@ -12,15 +13,28 @@ endif ...@@ -12,15 +13,28 @@ endif
test: $(TESTS) build test: $(TESTS) build
ifeq ($(findstring python-coverage,$(wildcard /usr/bin/*)), python-coverage)
coverage: ${COVERAGE} build
${COVERAGE} erase
${RM} ${COVERAGE_OUTPUT_DIR}/*
mkdir ${COVERAGE_OUTPUT_DIR} 2>/dev/null || true
for t in ${TESTS}; do \
echo $$t; \
${COVERAGE} -x test.py $$t; \
${COVERAGE} combine; \
done
${COVERAGE} html --omit=${OMIT} -d ${COVERAGE_OUTPUT_DIR}
else
coverage: ${COVERAGE} build coverage: ${COVERAGE} build
mkdir ${COVERAGE_OUTPUT_DIR} 2>/dev/null || true mkdir ${COVERAGE_OUTPUT_DIR} 2>/dev/null || true
${COVERAGE} erase ${COVERAGE} erase
for t in ${TESTS}; do \ for t in ${TESTS}; do \
echo $$t; \ echo $$t; \
${COVERAGE} ${OMIT} -x test.py $$t; \ ${COVERAGE} --omit ${OMIT} -x test.py $$t; \
${COVERAGE} ${OMIT} -c; \ ${COVERAGE} --omit ${OMIT} -c; \
done done
${COVERAGE} html ${OMIT} --dir ${COVERAGE_OUTPUT_DIR} ${COVERAGE} html --omit ${OMIT} --dir ${COVERAGE_OUTPUT_DIR}
endif
${COVERAGE}: ${COVERAGE}:
@echo "Install package 'python-coverage' to generate a coverage report." @echo "Install package 'python-coverage' to generate a coverage report."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment