diff --git a/.travis.yml b/.travis.yml index b0bdd46..5634e45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,14 @@ env: global: - PIP_DOWNLOAD_CACHE=$HOME/.pip_cache matrix: + - TOX_ENV=coverage + - TOX_ENV=flake8 - TOX_ENV=py27-django17 - TOX_ENV=py27-django18 - TOX_ENV=py27-django19 - TOX_ENV=py34-django17 - TOX_ENV=py34-django18 - TOX_ENV=py34-django19 - - TOX_ENV=flake8 cache: directories: - $HOME/.pip-cache/ @@ -22,4 +23,3 @@ script: - tox -e $TOX_ENV after_script: - cat .tox/$TOX_ENV/log/*.log - diff --git a/Makefile b/Makefile index 409d510..1fcffcb 100644 --- a/Makefile +++ b/Makefile @@ -47,9 +47,6 @@ test_venv/cas/manage.py: test_venv test_venv/bin/python test_venv/cas/manage.py migrate test_venv/bin/python test_venv/cas/manage.py createsuperuser -test_venv/bin/coverage: test_venv - test_venv/bin/pip install coverage - test_venv: test_venv/bin/python test_project: test_venv/cas/manage.py @@ -62,12 +59,11 @@ run_test_server: test_project tests: test_venv test_venv/bin/py.test -coverage: test_venv/bin/coverage - test_venv/bin/coverage run test_venv/bin/py.test - test_venv/bin/coverage html - rm htmlcov/coverage_html.js # I am really pissed off by those keybord shortcuts +coverage: test_venv + test_venv/bin/py.test --cov=cas_server --cov-report xml --cov-report html -coverage_codacy: coverage - test_venv/bin/coverage xml +test_venv/bin/python-codacy-coverage: test_venv/bin/pip install codacy-coverage + +coverage_codacy: coverage test_venv/bin/python-codacy-coverage test_venv/bin/python-codacy-coverage -r coverage.xml diff --git a/requirements-dev.txt b/requirements-dev.txt index b6bc994..3cf4247 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,6 +3,7 @@ tox>=1.8.1 pytest>=2.6.4 pytest-django>=2.8.0 pytest-pythonpath>=0.3 +pytest-cov>=2.2.1 requests>=2.4 requests_futures>=0.9.5 django-picklefield>=0.3.1 diff --git a/tox.ini b/tox.ini index 3e876df..d4b1d7e 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ envlist= py34-django18, py34-django19, flake8, + coverage [flake8] max-line-length=100 @@ -60,3 +61,13 @@ basepython=python deps=flake8 commands=flake8 {toxinidir}/cas_server +[testenv:coverage] +basepython=python +passenv=CODACY_PROJECT_TOKEN +deps= + -r{toxinidir}/requirements-dev.txt + codacy-coverage +commands= + py.test --cov=cas_server --cov-report xml + python-codacy-coverage -r {toxinidir}/coverage.xml +