Commit f39773c7 authored by Taddeus Kroes's avatar Taddeus Kroes

Added unit test framework and empty Cache class file.

parent dde4f128
*.swp
*~
*.pyc
OMIT=/usr/share/pyshared/*,/usr/local/lib/python*,*__init__.py,test*
COVERAGE_OUTPUT_DIR=coverage
TESTS=`find tests -name test_\*.py`
# Find python coverage version
ifeq ($(findstring python-coverage,$(wildcard /usr/bin/*)), python-coverage)
COVERAGE=/usr/bin/python-coverage
else
COVERAGE=`which coverage`
endif
all:
# Unit tests
test:
@for t in ${TESTS}; do \
python test.py $$t; \
done
# Cleanup
clean:
rm -rf .coverage ${COVERAGE_OUTPUT_DIR}
distclean: clean
rm -rf `find -name \*.pyc`
# Code coverage (differs between versions)
coverage: .coverage
ifeq ($(findstring python-coverage,$(wildcard /usr/bin/*)), python-coverage)
.coverage:
@${COVERAGE} erase
@rm -f ${COVERAGE_OUTPUT_DIR}/*
@mkdir -p ${COVERAGE_OUTPUT_DIR} 2>/dev/null || true
@for t in ${TESTS}; do \
${COVERAGE} -x test.py $$t; \
${COVERAGE} combine; \
done
@${COVERAGE} html --omit=${OMIT} -d ${COVERAGE_OUTPUT_DIR}
@rm $@
@echo "Coverage report created in ${COVERAGE_OUTPUT_DIR}/index.html"
else
.coverage:
@mkdir -p ${COVERAGE_OUTPUT_DIR} 2>/dev/null || true
@${COVERAGE} erase
@for t in ${TESTS}; do \
${COVERAGE} --omit ${OMIT} -x test.py $$t; \
${COVERAGE} --omit ${OMIT} -c; \
done
@${COVERAGE} html --omit ${OMIT} --dir ${COVERAGE_OUTPUT_DIR}
@rm $@
@echo "Coverage report created in ${COVERAGE_OUTPUT_DIR}/index.html"
endif
class Cache:
pass
#!/usr/bin/env python
from testrunner import main
import sys
main(sys.argv[1:])
import unittest
class TestCache(unittest.TestCase):
pass
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