diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2016-06-27 20:57:52 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-06-27 20:58:47 +0100 |
commit | 67f1c8de3e07bd3d969c460a78aa6a0e7675626a (patch) | |
tree | a58ba0a5a763c08dc0309d36ba1e784435bed302 | |
parent | ebdaae2e1ef7b6447927e0471da86885e89e0f78 (diff) | |
download | astroid-git-67f1c8de3e07bd3d969c460a78aa6a0e7675626a.tar.gz |
Add coverage configuration, backported from pylint.
-rw-r--r-- | .coveragerc | 9 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | README.rst | 3 | ||||
-rw-r--r-- | tox.ini | 37 |
5 files changed, 54 insertions, 3 deletions
diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..d4008f46 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,9 @@ +[paths] +source = + astroid + +[report] +include = + astroid/* +omit = + */test/* @@ -7,3 +7,5 @@ build dist/ astroid.egg-info/ .tox +.coverage +.coverage.* diff --git a/.travis.yml b/.travis.yml index 9075168a..d46d9864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,13 +29,15 @@ install: - $PYTHON_EXE -m pip install pip -U - python -m pip install tox - python -m pip install pip -U - - $PYTHON_EXE -m pip install tox + - $PYTHON_EXE -m pip install tox coverage coveralls - $PYTHON_EXE -m virtualenv --version - $PYTHON_EXE -m easy_install --version - $PYTHON_EXE -m pip --version - $PYTHON_EXE -m tox --version script: - - python -m tox -e $TOXENV + - python -m tox -e coverage-erase,$TOXENV +after_success: + - tox -e coveralls after_failure: - more .tox/log/* | cat - more .tox/*/log/* | cat @@ -8,6 +8,9 @@ Astroid :alt: AppVeyor Build Status :target: https://ci.appveyor.com/project/PCManticore/astroid +.. image:: https://coveralls.io/repos/github/PyCQA/astroid/badge.svg?branch=master + :target: https://coveralls.io/github/PyCQA/astroid?branch=master + What's this? @@ -17,4 +17,39 @@ deps = six wrapt pylint: git+https://github.com/pycqa/pylint@master -commands = python -Wi -m unittest discover -s {envsitepackagesdir}/astroid/tests -p "unittest*.py" + coverage + +setenv = + COVERAGE_FILE = {toxinidir}/.coverage.{envname} + +commands = + python -Wi {envsitepackagesdir}/coverage run -m unittest discover -s {envsitepackagesdir}/astroid/tests -p "unittest*.py" + ; Transform absolute path to relative path + ; for compatibility with coveralls.io and fix 'source not available' error. + ; If you can find a cleaner way is welcome + python -c "import os;cov_strip_abspath = open(os.environ['COVERAGE_FILE'], 'r').read().replace('.tox' + os.sep + os.path.relpath('{envsitepackagesdir}', '{toxworkdir}') + os.sep, '');open(os.environ['COVERAGE_FILE'], 'w').write(cov_strip_abspath)" + +[testenv:coveralls] +setenv = + COVERAGE_FILE = {toxinidir}/.coverage +passenv = + * +deps = + coverage + coveralls +skip_install = true +commands = + python {envsitepackagesdir}/coverage combine + python {envsitepackagesdir}/coverage report --rcfile={toxinidir}/.coveragerc -m + - coveralls --rcfile={toxinidir}/.coveragerc +changedir = {toxinidir} + +[testenv:coverage-erase] +setenv = + COVERAGE_FILE = {toxinidir}/.coverage +deps = + coverage +skip_install = true +commands = + python {envsitepackagesdir}/coverage erase +changedir = {toxinidir} |