From d797b193feece3069a7f461dfd963469009ca968 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Sat, 24 Sep 2016 15:48:35 -0500 Subject: [PATCH] Enable using coverage and coveralls for coverage reporting. Set this up on travis. This was just slightly tricky because of the use of 'j99' in the call to bin/test. --- .coveragerc | 9 +++++---- .gitignore | 2 ++ .travis.yml | 13 +++++++++++-- buildout.cfg | 13 ++++++++++--- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.coveragerc b/.coveragerc index 052c66f50..96b7410ee 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,8 +1,9 @@ [run] -# source = ... -# omit = ... -# cover_pylib = False -# branch = True +source = src/ZODB/ +parallel = true +omit = + src/ZODB/tests/* + src/ZODB/scripts/tests/* [report] exclude_lines = diff --git a/.gitignore b/.gitignore index 1b3dee815..7522b328d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ dist testing.log .eggs/ .dir-locals.el +htmlcov +tmp diff --git a/.travis.yml b/.travis.yml index 0bffaad58..c466ddcb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,13 +16,22 @@ matrix: - os: linux python: 3.5 install: + - pip install -U pip - pip install zc.buildout - buildout $BUILOUT_OPTIONS script: - - bin/test -v1j99 - - if [[ $TRAVIS_PYTHON_VERSION != 'pypy3' ]]; then cd doc; make html; fi + - if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then bin/coverage run bin/coverage-test -v1j99; fi + - if [[ $TRAVIS_PYTHON_VERSION == 'pypy' || $TRAVIS_PYTHON_VERSION == 'pypy3' ]]; then bin/test -v1j99; fi + - if [[ $TRAVIS_PYTHON_VERSION != 'pypy3' ]]; then pushd doc; make html; popd; fi + - if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then pip install coveralls; fi # install early enough to get into the cache +after_success: + - if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then bin/coverage combine; fi + - if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then coveralls; fi notifications: email: false cache: directories: + - $HOME/.cache/pip - eggs +before_cache: + - rm -f $HOME/.cache/pip/log/debug.log diff --git a/buildout.cfg b/buildout.cfg index cd5938256..6fc661112 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -2,6 +2,7 @@ develop = . parts = test + coverage-test scripts sphinx @@ -22,13 +23,18 @@ defaults = ['--all'] [coverage-test] recipe = zc.recipe.testrunner -eggs = ${test:eggs} +working-directory = . +eggs = + ${test:eggs} + coverage initialization = import os, tempfile try: os.mkdir('tmp') except: pass tempfile.tempdir = os.path.abspath('tmp') -defaults = ['--coverage', '${buildout:directory}/coverage'] + if 'COVERAGE_PROCESS_START' not in os.environ: os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' + else: import coverage; coverage.process_startup() +defaults = ['--all'] [coverage-report] recipe = zc.recipe.egg @@ -39,7 +45,8 @@ arguments = ('${buildout:directory}/coverage', [scripts] recipe = zc.recipe.egg -eggs = ${test:eggs} +eggs = + ${coverage-test:eggs} interpreter = py [sphinx]