Skip to content

Commit

Permalink
Make 'tox -e coverage' work
Browse files Browse the repository at this point in the history
It didn't work for me, because nose would crawl inside manual_tests, try
to run test_fstest.py, and fail (because that test is manual and
requires extra setup, like putting fstest.py on PYTHONPATH).

I also don't think that we want to exclude test layers from coverage
measurements (nose doesn't support them).

This change makes 'tox -e coverage' use zope.testrunner like it does for
regular tests.
  • Loading branch information
mgedmin committed Jan 12, 2015
1 parent 74e3d00 commit 9811ff9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
# source = ...
# omit = ...
# cover_pylib = False
# branch = True

[report]
exclude_lines =
pragma: nocover
if __name__ == ['"]__main__['"]:
assert False
25 changes: 5 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,11 @@ commands =
deps = {[testenv]deps}

[testenv:coverage]
basepython =
python2.7
basepython = python2.7
usedevelop = true
commands =
# The installed version messes up nose's test discovery / coverage reporting
# So, we uninstall that from the environment, and then install the editable
# version, before running nosetests.
pip uninstall -y ZODB
pip install -e .
nosetests --with-xunit --with-xcoverage
coverage run --source=ZODB -m zope.testrunner --test-path=src --auto-color --auto-progress
coverage report
deps =
nose
coverage
nosexcover
BTrees
ZConfig
manuel
persistent
six
transaction
zc.lockfile
zdaemon
zope.interface
zope.testing
{[testenv]deps}

0 comments on commit 9811ff9

Please sign in to comment.