Skip to content

Commit

Permalink
Add coverage to travis and fix coverage collection (#38)
Browse files Browse the repository at this point in the history
Fixes #26

Using pytest-cov (a pytest plugin) to measure the coverage of nbsmoke - which is itself a pytest plugin - is a little bit tricky. So just use coverage without the pytest-cov plugin.
  • Loading branch information
ceball committed Dec 19, 2019
1 parent 2366dde commit be86e2e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .travis.yml
Expand Up @@ -47,6 +47,11 @@ jobs:
# like a python-using developer
env: TOX_ENV=dev

- <<: *default
# measuring coverage of a pytest plugin using pytest-cov is slightly awkward,
# so we have a separate step for it
env: TOX_ENV=coverage

- <<: *default
stage: pip_package
install: true
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Expand Up @@ -6,6 +6,9 @@
:target: https://ci.appveyor.com/project/pyviz/nbsmoke/branch/master
:alt: See Build Status on AppVeyor

.. image:: https://coveralls.io/repos/github/pyviz-dev/nbsmoke/badge.svg?branch=master
:target: https://coveralls.io/github/pyviz-dev/nbsmoke?branch=master
:alt: See coverage stats on Coveralls

=======
nbsmoke
Expand Down
14 changes: 13 additions & 1 deletion tox.ini
@@ -1,12 +1,24 @@
[tox]
envlist = py27,py36,py37,py38,pypy,flake8,dev

# TODO: shouldn't be 'all' in every case.
# TODO: shouldn't be extras=all in every case.

[testenv]
commands = py.test -v {posargs:tests}
extras = all

[testenv:coverage]
setdevelop = True
passenv = TRAVIS TRAVIS_*
# don't use pytest-cov as nbsmoke is itself a pytest plugin, so things
# get confusing (e.g. nbsmoke gets imported before coverage collection
# starts, so all the module-level code is missed)
commands = coverage run --source=nbsmoke -m pytest
coverage report -m
coveralls
extras = all
deps = coveralls

[testenv:flake8]
skip_install = true
deps = flake8
Expand Down

0 comments on commit be86e2e

Please sign in to comment.