From 93224f8cf9986cf81373e1e9eec0b3d4ccd8a07d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 17 Sep 2018 12:41:57 +0200 Subject: [PATCH 1/4] tox: remove obsolete whitelist_externals --- tox.ini | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tox.ini b/tox.ini index 452bdc60d..b919c7e84 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,6 @@ envlist = docs [testenv] -whitelist_externals = env commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {posargs:testing} passenv = USER USERNAME @@ -58,7 +57,6 @@ deps = nose hypothesis>=3.56 {env:_PYTEST_TOX_EXTRA_DEP:} -whitelist_externals = env passenv = USER USERNAME TRAVIS commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto -ra {posargs:testing} @@ -79,7 +77,6 @@ platform = linux|darwin deps = pexpect {env:_PYTEST_TOX_EXTRA_DEP:} -whitelist_externals = env commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra test_pdb.py test_terminal.py test_unittest.py @@ -100,7 +97,6 @@ changedir=testing setenv = {[testenv]setenv} PYTHONDONTWRITEBYTECODE=1 -whitelist_externals = env passenv = USER USERNAME TRAVIS commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto -ra {posargs:.} @@ -109,7 +105,6 @@ commands = deps = twisted {env:_PYTEST_TOX_EXTRA_DEP:} -whitelist_externals = env commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/test_unittest.py} @@ -121,7 +116,6 @@ commands = {[testenv:py27-trial]commands} deps = numpy {env:_PYTEST_TOX_EXTRA_DEP:} -whitelist_externals = env commands= {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/python/approx.py} @@ -157,7 +151,6 @@ skipsdist = True deps = PyYAML {env:_PYTEST_TOX_EXTRA_DEP:} -whitelist_externals = env commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra doc/en {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest From 739f9a4a4b0ae2efe105f3a6561088dac5096941 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 17 Sep 2018 12:40:12 +0200 Subject: [PATCH 2/4] Travis: use codecov-bash Faster to install and will retry uploads on connection errors. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f00324ed..dd7529d20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,11 +94,11 @@ after_success: - | if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then set -e - pip install codecov + pip install coverage coverage combine coverage xml --ignore-errors coverage report -m --ignore-errors - codecov --required -X gcov pycov search -f coverage.xml --flags ${TOXENV//-/ } linux + bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -F "${TOXENV//-/,},linux" # Coveralls does not support merged reports. if [[ "$TOXENV" = py37 ]]; then From 03eaad376b390964b650c2fec5fcee00f9870d4e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 17 Sep 2018 12:41:06 +0200 Subject: [PATCH 3/4] tox: coverage factor: combine and report --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index b919c7e84..1c77f989d 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,8 @@ envlist = [testenv] commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {posargs:testing} + coverage: coverage combine + coverage: coverage report passenv = USER USERNAME setenv = # configuration if a user runs tox with a "coverage" factor, for example "tox -e py36-coverage" From 28c9cc73217c3052575056c5cae3a69ad0ecf9bb Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 17 Sep 2018 12:00:03 +0200 Subject: [PATCH 4/4] coverage: use modules for source This should increase coverage for subprocesses, where previously `source` paths were used only from the config file, but not the initial `--source` argument. --- .coveragerc | 7 ++++++- .travis.yml | 2 +- scripts/prepare-coverage.bat | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.coveragerc b/.coveragerc index 9ef955843..97934dc3b 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,9 @@ [run] -source = _pytest,testing +source = pytest,_pytest,testing/ parallel = 1 branch = 1 + +[paths] +source = src/ + .tox/*/lib/python*/site-packages/ + .tox\*\Lib\site-packages\ diff --git a/.travis.yml b/.travis.yml index dd7529d20..a319c0922 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,7 +84,7 @@ before_script: if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then export COVERAGE_FILE="$PWD/.coverage" export COVERAGE_PROCESS_START="$PWD/.coveragerc" - export _PYTEST_TOX_COVERAGE_RUN="coverage run --source {envsitepackagesdir}/_pytest/,{toxinidir}/testing -m" + export _PYTEST_TOX_COVERAGE_RUN="coverage run -m" export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess fi diff --git a/scripts/prepare-coverage.bat b/scripts/prepare-coverage.bat index fbf4da66a..bff1e62b0 100644 --- a/scripts/prepare-coverage.bat +++ b/scripts/prepare-coverage.bat @@ -2,7 +2,7 @@ REM scripts called by AppVeyor to setup the environment variables to enable cove if not defined PYTEST_NO_COVERAGE ( set "COVERAGE_FILE=%CD%\.coverage" set "COVERAGE_PROCESS_START=%CD%\.coveragerc" - set "_PYTEST_TOX_COVERAGE_RUN=coverage run --source {envsitepackagesdir}/_pytest/,{toxinidir}/testing -m" + set "_PYTEST_TOX_COVERAGE_RUN=coverage run -m" set "_PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess" echo Coverage setup completed ) else (