Use pytest for coverage

This commit is contained in:
Brad Warren 2017-11-28 17:42:26 -08:00
parent a2268a212e
commit d6be9302ec
5 changed files with 13 additions and 19 deletions

View file

@ -1,3 +1,2 @@
[report]
# show lines missing coverage in output
show_missing = True
omit = */setup.py

View file

@ -68,6 +68,7 @@ dev_extras = [
'coverage',
'ipdb',
'pytest',
'pytest-cov',
'pytest-xdist',
'pylint==1.4.2', # upstream #248
'tox',

View file

@ -45,6 +45,7 @@ pyasn1-modules==0.1.5
Pygments==2.2.0
pylint==1.4.2
pytest==3.3.0
pytest-cov==2.5.1
pytest-forked==0.2
pytest-xdist==1.20.1
python-dateutil==2.6.1

View file

@ -55,7 +55,7 @@ SUBPKGS="$SUBPKGS_IN_AUTO $SUBPKGS_NOT_IN_AUTO"
subpkgs_modules="$(echo $SUBPKGS | sed s/-/_/g)"
# certbot_compatibility_test is not packaged because:
# - it is not meant to be used by anyone else than Certbot devs
# - it causes problems when running nosetests - the latter tries to
# - it causes problems when running pytest - the latter tries to
# run everything that matches test*, while there are no unittests
# there
@ -166,10 +166,10 @@ fi
mkdir kgs
kgs="kgs/$version"
pip freeze | tee $kgs
pip install nose
pip install pytest
for module in $subpkgs_modules ; do
echo testing $module
nosetests $module
pytest --pyargs $module
done
cd ~-

View file

@ -16,7 +16,7 @@ fi
cover () {
if [ "$1" = "certbot" ]; then
min=98
min=97
elif [ "$1" = "acme" ]; then
min=100
elif [ "$1" = "certbot_apache" ]; then
@ -24,23 +24,23 @@ cover () {
elif [ "$1" = "certbot_dns_cloudflare" ]; then
min=98
elif [ "$1" = "certbot_dns_cloudxns" ]; then
min=99
min=98
elif [ "$1" = "certbot_dns_digitalocean" ]; then
min=98
elif [ "$1" = "certbot_dns_dnsimple" ]; then
min=98
elif [ "$1" = "certbot_dns_dnsmadeeasy" ]; then
min=99
min=98
elif [ "$1" = "certbot_dns_google" ]; then
min=99
elif [ "$1" = "certbot_dns_luadns" ]; then
min=98
elif [ "$1" = "certbot_dns_nsone" ]; then
min=99
min=98
elif [ "$1" = "certbot_dns_rfc2136" ]; then
min=99
elif [ "$1" = "certbot_dns_route53" ]; then
min=99
min=91
elif [ "$1" = "certbot_nginx" ]; then
min=97
elif [ "$1" = "letshelp_certbot" ]; then
@ -50,17 +50,10 @@ cover () {
exit 1
fi
# "-c /dev/null" makes sure setup.cfg is not loaded (multiple
# --with-cover add up, --cover-erase must not be set for coveralls
# to get all the data); --with-cover scopes coverage to only
# specific package, positional argument scopes tests only to
# specific package directory; --cover-tests makes sure every tests
# is run (c.f. #403)
nosetests -c /dev/null --with-cover --cover-tests --cover-package \
"$1" --cover-min-percentage="$min" "$1"
pytest --cov "$1" --cov-report term-missing \
--cov-fail-under "$min" --numprocesses auto --pyargs "$1"
}
rm -f .coverage # --cover-erase is off, make sure stats are correct
for pkg in $pkgs
do
cover $pkg