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]
source = _pytest,testing
source = pytest,_pytest,testing/
parallel = 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
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
@ -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

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 (
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 (

View File

@ -17,9 +17,10 @@ envlist =
docs
[testenv]
whitelist_externals = env
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"
@ -58,7 +59,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 +79,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 +99,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 +107,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 +118,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 +153,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