4 # Author: Lea Wiemann <LeWiemann@gmail.com>
5 # Copyright: This script has been placed in the public domain.
7 # Usage: ./coverage.sh [project, [module]]
10 # Resolve all symlinks in current path.
13 if test "$proj" == test; then
20 module
="${2:-alltests.py}"
21 module
="${module#test/}"
22 echo "Performing code coverage test for project \"$proj\", test module \"$module\"..."
24 echo "Please be patient; coverage tracking slows test execution down by more"
25 echo "than factor 10."
30 python
-u -m trace
--count --coverdir=cover
--missing "$module"
38 find "$proj/" -name \
*.py |
while read i
; do
40 test -f test
/cover
/"${i//\//.}".cover -o "${i##*/}" == Template || echo "${i//\//.}" "`cat "$i.py
" | wc -l`"
43 find . \
( -name .
-o ! -name "$proj".\
* -exec rm {} \
; \
)
45 sed 's/^>>>>>> \(.*"""\)/ \1/' < "$i" > "${i%.cover}"
48 for i
in *; do echo -n "$i "; grep -c '^>>>>>> ' "$i" || true
; done
49 ) |
grep -v ' 0$' |
sort -nk 2