Ver código fonte

Added code coverage option to Makefile.

Taddeus Kroes 13 anos atrás
pai
commit
ce703aeed2
2 arquivos alterados com 15 adições e 2 exclusões
  1. 2 0
      .gitignore
  2. 13 2
      Makefile

+ 2 - 0
.gitignore

@@ -3,3 +3,5 @@
 *~
 *.bak
 data/
+coverage/*
+.coverage

+ 13 - 2
Makefile

@@ -1,9 +1,20 @@
 TEST := test.py
+COVERAGE_DIR := coverage
+COVERAGE_OMIT=/usr/share/pyshared/*,test.py,tests/*
 
 test:
 	@pyrg $(TEST)
 
+coverage:
+	coverage erase
+	@if [ -d $(COVERAGE_DIR) ]; then rm -rf $(COVERAGE_DIR)/* \
+	else mkdir $(COVERAGE_DIR); fi
+	coverage run test.py
+	coverage html --omit=$(COVERAGE_OMIT) -d $(COVERAGE_DIR)
+	coverage report --omit=$(COVERAGE_OMIT)
+
 clean:
-	rm `find -name \*.pyc`
+	coverage erase
+	rm -rf $(COVERAGE_DIR) `find -name \*.pyc`
 
-.PHONY: test clean
+.PHONY: test clean coverage