From 8955a321a7b4fbd1920d9ff130b14f285c919a50 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 23 Nov 2017 12:40:09 +0100 Subject: [PATCH] Add coverage reporting Signed-off-by: Christian Heimes --- .coveragerc | 26 ++++++++++++++++++++++++++ .gitignore | 2 ++ .travis.yml | 6 +++++- Makefile | 11 +++++++++++ Tests/__init__.py | 1 + Tests/t_untested_mods.py | 15 +++++++++++++++ tox.ini | 13 +++++++++++-- 7 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 .coveragerc create mode 100644 Makefile create mode 100644 Tests/t_untested_mods.py diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..fc432b9 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,26 @@ +[run] +branch = True +source = + Lib/ +omit = + Lib/slapdtest.py + +[paths] +source = + Lib/ + .tox/*/lib/python*/site-packages/ + +[report] +ignore_errors = False +precision = 1 +exclude_lines = + pragma: no cover + raise NotImplementedError + if 0: + if __name__ == .__main__.: + if PY2 + if not PY2 + +[html] +directory = build/htmlcov +title = python-ldap coverage report diff --git a/.gitignore b/.gitignore index 072e203..03b366d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ *.pyc __pycache__/ .tox +.coverage* +!.coveragerc # shared libs installed by 'setup.py test' /Lib/*.so* diff --git a/.travis.yml b/.travis.yml index 542377d..48f09be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,10 @@ addons: install: - pip install "pip>=7.1.0" - - pip install tox-travis tox + - pip install tox-travis tox codecov coverage script: tox + +after_success: + - python -m coverage combine + - codecov diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..56aaa8c --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +.NOTPARALLEL: + +.PHONY: all +all: + +.PHONY: clean +clean: + rm -rf build dist *.egg-info $(VENV) .tox + rm -f .coverage .coverage.* + find . -name '*.py[co]' -or -name '*.so*' -or -name '*.dylib' -delete + find . -depth -name __pycache__ -exec rm -rf {} \; diff --git a/Tests/__init__.py b/Tests/__init__.py index 46b3861..9f54f87 100644 --- a/Tests/__init__.py +++ b/Tests/__init__.py @@ -20,3 +20,4 @@ from . import t_ldapobject from . import t_edit from . import t_ldap_schema_subentry +from . import t_untested_mods diff --git a/Tests/t_untested_mods.py b/Tests/t_untested_mods.py new file mode 100644 index 0000000..6221f24 --- /dev/null +++ b/Tests/t_untested_mods.py @@ -0,0 +1,15 @@ +# modules without any tests +import ldap.async +import ldap.controls.deref +import ldap.controls.openldap +import ldap.controls.pagedresults +import ldap.controls.ppolicy +import ldap.controls.psearch +import ldap.controls.pwdpolicy +import ldap.controls.readentry +import ldap.controls.sessiontrack +import ldap.controls.sss +import ldap.controls.vlv +import ldap.logger +import ldap.resiter +import ldap.syncrepl diff --git a/tox.ini b/tox.ini index 61a6aed..417c7aa 100644 --- a/tox.ini +++ b/tox.ini @@ -5,10 +5,19 @@ [tox] # Note: when updating Python versions, also change setup.py and .travis.yml -envlist = py27,py33,py34,py35,py36 +envlist = py27,py33,py34,py35,py36,coverage-report [testenv] -commands = {envpython} setup.py test deps = + coverage pyasn1 pyasn1_modules +commands = {envpython} -m coverage run --parallel setup.py test + +[testenv:coverage-report] +deps = coverage +skip_install = true +commands = + {envpython} -m coverage combine + {envpython} -m coverage report --show-missing + {envpython} -m coverage html