Permalink
Browse files

add test.sh, fix pyflakes warning, check in the best-ever code covera…

…ge summary for future reference
  • Loading branch information...
1 parent c4b53f0 commit 058df517c83acda3aff5d84a451a0ebe65e723fa @zookos zookos committed Apr 21, 2010
Showing with 41 additions and 0 deletions.
  1. +8 −0 .coverage-results/best/summary.txt
  2. +1 −0 geojson/__init__.py
  3. +32 −0 test.sh
@@ -0,0 +1,8 @@
+Name Stmts Miss Branch BrPart Cover
+------------------------------------------------------------------
+geojson/__init__ 251 28 82 23 84%
+geojson/test/__init__ 1 0 0 0 100%
+geojson/test/unit/__init__ 1 0 0 0 100%
+geojson/test/unit/test_geojson 156 1 16 1 98%
+------------------------------------------------------------------
+TOTAL 409 29 98 24 89%
View
@@ -7,6 +7,7 @@
try:
import simplejson as json
+ json # just to pacify pyflakes: http://divmod.org/trac/ticket/1499
except ImportError:
import json
View
32 test.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Write down the current git version just for future reference.
+mkdir -p .coverage-results
+git log | head -1 > .coverage-results/version-stamp.txt
+
+# This script depends on trialcoverage >= 0.3.5 and on coverage.py >= 3.3.2a1z8.
+# The following lines will print an ugly warning message if those two are not
+# installed.
+python -c 'import pkg_resources;pkg_resources.require("trialcoverage>=0.3.5")' &&
+python -c 'import pkg_resources;pkg_resources.require("coverage>=3.3.2a1z8")' &&
+
+python -tt setup.py flakes
+RETVAL=$?
+if [ ${RETVAL} != 0 ] ; then
+ echo "FAILED: pyflakes reported warnings -- exiting"
+ exit ${RETVAL}
+fi
+
+# Now run the tests once just to make sure all test_requires dependencies are
+# installed before we start paying attention to code coverage.
+
+python setup.py trial > /dev/null 2> /dev/null
+
+python -tt setup.py trial --reporter=bwverbose-coverage --rterrors
+RETVAL=$?
+echo "To see coverage details run 'coverage report' or open htmlcov/index.html."
+coverage html
+if [ ${RETVAL} = 0 ]; then
+ echo SUCCESS
+fi
+exit $RETVAL

0 comments on commit 058df51

Please sign in to comment.