Merge pull request #3990 from blueyed/coverage-source

coverage: use modules
This commit is contained in:
Bruno Oliveira 2018-09-19 19:55:11 -03:00 committed by GitHub
commit 10b3b2dc68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,9 @@
[run] [run]
source = _pytest,testing source = pytest,_pytest,testing/
parallel = 1 parallel = 1
branch = 1 branch = 1
[paths]
source = src/
.tox/*/lib/python*/site-packages/
.tox\*\Lib\site-packages\

View File

@ -84,7 +84,7 @@ before_script:
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
export COVERAGE_FILE="$PWD/.coverage" export COVERAGE_FILE="$PWD/.coverage"
export COVERAGE_PROCESS_START="$PWD/.coveragerc" 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 export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
fi fi
@ -94,11 +94,11 @@ after_success:
- | - |
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
set -e set -e
pip install codecov pip install coverage
coverage combine coverage combine
coverage xml --ignore-errors coverage xml --ignore-errors
coverage report -m --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. # Coveralls does not support merged reports.
if [[ "$TOXENV" = py37 ]]; then if [[ "$TOXENV" = py37 ]]; then

View File

@ -2,7 +2,7 @@ REM scripts called by AppVeyor to setup the environment variables to enable cove
if not defined PYTEST_NO_COVERAGE ( if not defined PYTEST_NO_COVERAGE (
set "COVERAGE_FILE=%CD%\.coverage" set "COVERAGE_FILE=%CD%\.coverage"
set "COVERAGE_PROCESS_START=%CD%\.coveragerc" 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" set "_PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess"
echo Coverage setup completed echo Coverage setup completed
) else ( ) else (

View File

@ -17,9 +17,10 @@ envlist =
docs docs
[testenv] [testenv]
whitelist_externals = env
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {posargs:testing} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {posargs:testing}
coverage: coverage combine
coverage: coverage report
passenv = USER USERNAME passenv = USER USERNAME
setenv = setenv =
# configuration if a user runs tox with a "coverage" factor, for example "tox -e py36-coverage" # configuration if a user runs tox with a "coverage" factor, for example "tox -e py36-coverage"
@ -58,7 +59,6 @@ deps =
nose nose
hypothesis>=3.56 hypothesis>=3.56
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
passenv = USER USERNAME TRAVIS passenv = USER USERNAME TRAVIS
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto -ra {posargs:testing} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto -ra {posargs:testing}
@ -79,7 +79,6 @@ platform = linux|darwin
deps = deps =
pexpect pexpect
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra test_pdb.py test_terminal.py test_unittest.py {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra test_pdb.py test_terminal.py test_unittest.py
@ -100,7 +99,6 @@ changedir=testing
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
PYTHONDONTWRITEBYTECODE=1 PYTHONDONTWRITEBYTECODE=1
whitelist_externals = env
passenv = USER USERNAME TRAVIS passenv = USER USERNAME TRAVIS
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto -ra {posargs:.} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto -ra {posargs:.}
@ -109,7 +107,6 @@ commands =
deps = deps =
twisted twisted
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/test_unittest.py} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/test_unittest.py}
@ -121,7 +118,6 @@ commands = {[testenv:py27-trial]commands}
deps = deps =
numpy numpy
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
commands= commands=
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/python/approx.py} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/python/approx.py}
@ -157,7 +153,6 @@ skipsdist = True
deps = deps =
PyYAML PyYAML
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra doc/en {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra doc/en
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest