From c4d6de2aab8f0a648ddfe7aff7ef558c65f6bbf2 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 23 Feb 2019 10:06:31 +0100 Subject: [PATCH] tests: add coverage tox factor, use it on Travis --- .coveragerc | 1 + .travis.yml | 11 +++++------ pytest.ini | 2 ++ tox.ini | 13 +++++-------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.coveragerc b/.coveragerc index 7059cc3..c022851 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,5 @@ [run] +source = parso [report] # Regexes for lines to exclude from consideration diff --git a/.travis.yml b/.travis.yml index 345d481..447a1e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,15 +11,14 @@ python: matrix: include: - python: 3.5 - env: TOXENV=cov - allow_failures: - - env: TOXENV=cov + env: TOXENV=py35-coverage install: - pip install --quiet tox-travis script: - tox after_script: - - if [ $TOXENV == "cov" ]; then - pip install --quiet coveralls; - coveralls; + - | + if [ "${TOXENV%-coverage}" == "$TOXENV" ]; then + pip install --quiet coveralls; + coveralls; fi diff --git a/pytest.ini b/pytest.ini index 6cb23bf..cd6a4af 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,8 @@ [pytest] addopts = --doctest-modules +testpaths = parso test + # Ignore broken files inblackbox test directories norecursedirs = .* docs scripts normalizer_issue_files build diff --git a/tox.ini b/tox.ini index d4bb92d..297d80e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,19 +1,16 @@ [tox] -envlist = py27, py33, py34, py35, py36, py37, pypy +envlist = {py27,py33,py34,py35,py36,py37,pypy}{,-coverage} [testenv] extras = testing deps = py26,py33: pytest>=3.0.7,<3.3 py26,py33: setuptools<37 + coverage: coverage setenv = # https://github.com/tomchristie/django-rest-framework/issues/1957 # tox corrupts __pycache__, solution from here: PYTHONDONTWRITEBYTECODE=1 + coverage: TOX_TESTENV_COMMAND=coverage run -m pytest commands = - pytest {posargs:parso test} -[testenv:cov] -deps = - coverage -commands = - coverage run --source parso -m pytest - coverage report + {env:TOX_TESTENV_COMMAND:pytest} {posargs} + coverage: coverage report