Skip to content

Commit

Permalink
Run pytest inside tox with coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Oct 17, 2017
1 parent 221998b commit 06f1278
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 6 deletions.
34 changes: 34 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[run]
# measure 'branch' coverage in addition to 'statement' coverage
# See: http://coverage.readthedocs.org/en/coverage-4.0.3/branch.html#branch
branch = True

# list of directories or packages to measure
source = ufo2ft

# these are treated as equivalent when combining data
[paths]
source =
Lib/ufo2ft
.tox/*/lib/python*/site-packages/ufo2ft
.tox/pypy*/site-packages/ufo2ft

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# keywords to use in inline comments to skip coverage
pragma: no cover

# don't complain if tests don't hit defensive assertion code
raise AssertionError
raise NotImplementedError

# don't complain if non-runnable code isn't run
if 0:
if __name__ == .__main__.:

# ignore source code that can’t be found
ignore_errors = True

# when running a summary report, show missing lines
show_missing = True
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
sudo: false
language: python
python:
- "2.7"
- "3.6"
matrix:
include:
- python: 2.7
env: TOXENV=py27-cov
- python: 3.6
env: TOXENV=py36-cov
branches:
only:
- master
- /^v\d+\.\d+.*$/

install: pip install tox-travis
install: pip install tox
script: tox

deploy:
Expand Down
19 changes: 17 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
[tox]
envlist = py27, py36
envlist = py{27,36}-cov, htmlcov

[testenv]
deps =
cov: coverage
pytest
-rrequirements.txt
commands =
py.test {posargs}
# run the test suite against the package installed inside tox env.
# We use parallel mode and then combine later so that coverage.py will take
# paths like .tox/py36/lib/python3.6/site-packages/fontTools and collapse
# them into Lib/fontTools.
cov: coverage run --parallel-mode -m pytest {posargs}
nocov: pytest {posargs}

[testenv:htmlcov]
basepython = python3.6
deps =
coverage
skip_install = true
commands =
coverage combine
coverage html

0 comments on commit 06f1278

Please sign in to comment.