From 9e67e37aec04185dce8b892e620ba1f47815e839 Mon Sep 17 00:00:00 2001 From: Abhishek Fatehpuria Date: Tue, 13 Sep 2016 16:28:27 -0700 Subject: [PATCH] [tests] Adding codecov (#2) --- .coveragerc | 12 ++++++------ .gitignore | 2 ++ .travis.yml | 5 +++-- README.rst | 6 +++++- docs/templates/readme.txt | 6 +++++- requirements/test.txt | 1 + setup.cfg | 1 + tox.ini | 9 +++++++-- 8 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.coveragerc b/.coveragerc index e9c27a8..244d533 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,17 +1,17 @@ [run] branch = 1 cover_pylib = 0 -include = *drf_mfa/* -omit = drf_mfa.tests.* +include = *deux/* +omit = deux.tests.* [report] omit = */python?.?/* */site-packages/* */pypy/* - drf_mfa/app_settings.py - drf_mfa/exceptions.py - drf_mfa/tests/* - drf_mfa/migrations/* + deux/app_settings.py + deux/exceptions.py + deux/tests/* + deux/migrations/* manage.py test_proj/* diff --git a/.gitignore b/.gitignore index 463bc34..b705b4e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,6 @@ Documentation/ celery/tests/cover/ .ve* cover/ +coverage.* +htmlcov/ .vagrant/ diff --git a/.travis.yml b/.travis.yml index 46ed04c..40dad89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ env: - TOXENV=flake8 - TOXENV=flakeplus - TOXENV=apicheck + - TOXENV=cov before_install: - | if [ "$TOXENV" = "pypy" ]; then @@ -34,5 +35,5 @@ before_install: install: travis_retry pip install -U tox script: tox -v -- -v after_success: - - .tox/$TRAVIS_PYTHON_VERSION/bin/coverage xml - - .tox/$TRAVIS_PYTHON_VERSION/bin/codecov -e TOXENV + - .tox/$TOXENV/bin/coverage xml + - .tox/$TOXENV/bin/codecov -e TOXENV diff --git a/README.rst b/README.rst index feb555e..642ae5d 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ :width: 721 :height: 250 -|build-status| |license| |wheel| |pyversion| |pyimp| +|build-status| |codecov| |license| |wheel| |pyversion| |pyimp| :Version: 1.0.0 :Web: https://deux.readthedocs.org/ @@ -102,3 +102,7 @@ You can install it by doing the following: :alt: Support Python implementations. :target: https://pypi.python.org/pypi/deux/ +.. |codecov| image:: https://codecov.io/gh/robinhood/deux/branch/master/graph/badge.svg + :alt: Code Coverage + :target: https://codecov.io/gh/robinhood/deux + diff --git a/docs/templates/readme.txt b/docs/templates/readme.txt index ee09e8d..b5ace7c 100644 --- a/docs/templates/readme.txt +++ b/docs/templates/readme.txt @@ -3,7 +3,7 @@ :width: 721 :height: 250 -|build-status| |license| |wheel| |pyversion| |pyimp| +|build-status| |codecov| |license| |wheel| |pyversion| |pyimp| .. include:: ../includes/introduction.txt @@ -28,3 +28,7 @@ .. |pyimp| image:: https://img.shields.io/pypi/implementation/deux.svg :alt: Support Python implementations. :target: https://pypi.python.org/pypi/deux/ + +.. |codecov| image:: https://codecov.io/gh/robinhood/deux/branch/master/graph/badge.svg + :alt: Code Coverage + :target: https://codecov.io/gh/robinhood/deux diff --git a/requirements/test.txt b/requirements/test.txt index a417d25..ccf32a0 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,5 @@ mock==2.0.0 coverage>=3.0 +pytest-cov>=2.3.1,<3.0.0 pytest-django>=3.0.0,<4.0.0 pytest-runner>=2.9,<3.0 diff --git a/setup.cfg b/setup.cfg index e3dfcd8..d4c2558 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,6 +4,7 @@ test=pytest [tool:pytest] DJANGO_SETTINGS_MODULE = test_proj.settings testpaths = deux +addopts = --cov=deux --cov-report term --cov-report html:cover --color yes --no-cov-on-fail [wheel] universal = 1 diff --git a/tox.ini b/tox.ini index 4fd5622..15289bf 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ envlist = flakeplus apicheck configcheck + cov [testenv] deps= @@ -27,10 +28,10 @@ deps= flake8,flakeplus: -r{toxinidir}/requirements/pkgutils.txt sitepackages = False recreate = False -commands = coverage run setup.py test +commands = pytest --cov-report=xml basepython = - 2.7,flake8,flakeplus,apicheck,linkcheck,configcheck: python2.7 + 2.7,flake8,flakeplus,apicheck,linkcheck,configcheck,cov: python2.7 3.4: python3.4 3.5: python3.5 pypy: pypy @@ -54,3 +55,7 @@ commands = [testenv:flakeplus] commands = flakeplus --2.7 {toxinidir}/deux + +[testenv:cov] +commands = + pytest -xv --cov-report=xml