tests: add coverage tox factor, use it on Travis

This commit is contained in:
Daniel Hahler
2019-02-23 10:06:31 +01:00
committed by Dave Halter
parent 7770e73609
commit c4d6de2aab
4 changed files with 13 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
[run] [run]
source = parso
[report] [report]
# Regexes for lines to exclude from consideration # Regexes for lines to exclude from consideration

View File

@@ -11,15 +11,14 @@ python:
matrix: matrix:
include: include:
- python: 3.5 - python: 3.5
env: TOXENV=cov env: TOXENV=py35-coverage
allow_failures:
- env: TOXENV=cov
install: install:
- pip install --quiet tox-travis - pip install --quiet tox-travis
script: script:
- tox - tox
after_script: after_script:
- if [ $TOXENV == "cov" ]; then - |
if [ "${TOXENV%-coverage}" == "$TOXENV" ]; then
pip install --quiet coveralls; pip install --quiet coveralls;
coveralls; coveralls;
fi fi

View File

@@ -1,6 +1,8 @@
[pytest] [pytest]
addopts = --doctest-modules addopts = --doctest-modules
testpaths = parso test
# Ignore broken files inblackbox test directories # Ignore broken files inblackbox test directories
norecursedirs = .* docs scripts normalizer_issue_files build norecursedirs = .* docs scripts normalizer_issue_files build

13
tox.ini
View File

@@ -1,19 +1,16 @@
[tox] [tox]
envlist = py27, py33, py34, py35, py36, py37, pypy envlist = {py27,py33,py34,py35,py36,py37,pypy}{,-coverage}
[testenv] [testenv]
extras = testing extras = testing
deps = deps =
py26,py33: pytest>=3.0.7,<3.3 py26,py33: pytest>=3.0.7,<3.3
py26,py33: setuptools<37 py26,py33: setuptools<37
coverage: coverage
setenv = setenv =
# https://github.com/tomchristie/django-rest-framework/issues/1957 # https://github.com/tomchristie/django-rest-framework/issues/1957
# tox corrupts __pycache__, solution from here: # tox corrupts __pycache__, solution from here:
PYTHONDONTWRITEBYTECODE=1 PYTHONDONTWRITEBYTECODE=1
coverage: TOX_TESTENV_COMMAND=coverage run -m pytest
commands = commands =
pytest {posargs:parso test} {env:TOX_TESTENV_COMMAND:pytest} {posargs}
[testenv:cov] coverage: coverage report
deps =
coverage
commands =
coverage run --source parso -m pytest
coverage report