Skip to content

Commit

Permalink
Enable using coverage and coveralls for coverage reporting.
Browse files Browse the repository at this point in the history
Set this up on travis.

This was just slightly tricky because of the use of 'j99' in the call to
bin/test.
  • Loading branch information
jamadden committed Sep 24, 2016
1 parent bdecbf6 commit b46bb5a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
9 changes: 5 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ dist
testing.log
.eggs/
.dir-locals.el
htmlcov
tmp
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ install:
- pip install zc.buildout
- buildout $BUILOUT_OPTIONS
script:
- bin/test -v1j99
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy' -a $TRAVIS_PYTHON_VERSION != 'pypy3' ]]; then bin/coverage run bin/test -v1j99; fi
- if [[ $TRAVIS_PYTHON_VERSION == 'pypy' -o $TRAVIS_PYTHON_VERSION == 'pypy3' ]]; then bin/test -v1j99; fi
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy3' ]]; then cd doc; make html; fi
after_success:
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy' -a $TRAVIS_PYTHON_VERSION != 'pypy3' ]]; then pip install coveralls; fi
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy' -a $TRAVIS_PYTHON_VERSION != 'pypy3' ]]; then bin/coverage combine; fi
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy' -a $TRAVIS_PYTHON_VERSION != 'pypy3' ]]; then coveralls; fi
notifications:
email: false
cache:
directories:
- $HOME/.cache/pip
- eggs
before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
13 changes: 10 additions & 3 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
develop = .
parts =
test
coverage-test
scripts
sphinx

Expand All @@ -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
Expand All @@ -39,7 +45,8 @@ arguments = ('${buildout:directory}/coverage',

[scripts]
recipe = zc.recipe.egg
eggs = ${test:eggs}
eggs =
${coverage-test:eggs}
interpreter = py

[sphinx]
Expand Down

0 comments on commit b46bb5a

Please sign in to comment.