diff --git a/.gitignore b/.gitignore index 429cb18..e029203 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ __pycache__ *~ *.swp tags +.coverage +htmlcov diff --git a/.travis.yml b/.travis.yml index e1e3b34..ffe9a71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,10 @@ language: python sudo: enabled python: - "3.6" + +install: + - pip install -r requirements.txt + # command to run tests script: - make check diff --git a/Makefile b/Makefile index c0e8522..84b2708 100644 --- a/Makefile +++ b/Makefile @@ -47,4 +47,7 @@ test_autospec: python3 tests/test_autospec.py -c ${CASES} unittests: - PYTHONPATH=${CURDIR}/autospec python3 -m unittest discover -b -s tests -p 'test_*.py' + PYTHONPATH=${CURDIR}/autospec coverage run -m unittest discover -b -s tests -p 'test_*.py' && coverage report + +coverage: + coverage report -m diff --git a/requirements.txt b/requirements.txt index 2a0f42f..1c42f1d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ flake8>=3.4.0 pycurl>=7.43.0 toml>=0.9.0 mock>=2.0.0 +coverage>=4.4.1 diff --git a/setup.cfg b/setup.cfg index 6aacf32..760115e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,3 +2,7 @@ tag_build = [pycodestyle] ignore = E501 + +[coverage:run] +# omit tests and travis site-packages +omit = tests/*,*site-packages*,*site.py