/
buildout.cfg
64 lines (53 loc) · 1.57 KB
/
buildout.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
[buildout]
parts = test coverage code-analysis createcoverage coverage-sh py
package-min-coverage = 80
develop = .
[test]
recipe = zc.recipe.testrunner
eggs = yafowil[test]
defaults = ['--auto-color', '--auto-progress']
[coverage]
recipe = zc.recipe.testrunner
eggs = ${test:eggs}
defaults = ['--coverage', '../../coverage', '-v', '--auto-progress']
[code-analysis]
recipe = plone.recipe.codeanalysis
directory = src
pre-commit-hook = True
flake8 = True
flake8-ignore = C901
return-status-codes = True
[createcoverage]
recipe = zc.recipe.egg
eggs = createcoverage
[coverage-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/coverage.sh
mode = 755
input = inline:
#! /bin/sh
# checks for report created with createcoverage and evaluate the result
DEFAULT=${buildout:package-min-coverage}
REPORT="htmlcov/index.html"
if [ "$#" -eq 1 ] && [ $1 -ge 0 ] && [ $1 -le 100 ]; then
MINIMUM=$1
else
echo "Invalid value for minimum coverage; using default: $DEFAULT%"
MINIMUM=$DEFAULT
fi
if [ ! -f "$REPORT" ]; then
bin/createcoverage run "bin/test -t yafowil"
fi
# find first percentage value in file (module test coverage) and return it
COVERAGE=`grep "[0-9]\{1,3\}[%]" $REPORT -m 1 -o | grep "[0-9]\{1,3\}" -o`
if [ $COVERAGE -lt $MINIMUM ]; then
echo "Insufficient test coverage: $COVERAGE% (minimum acceptable is $MINIMUM%)"
exit 1
else
echo "Current test coverage: $COVERAGE%"
exit 0
fi
[py]
recipe = zc.recipe.egg
eggs = ${test:eggs}
interpreter = py