Skip to content

Travis: report coverage with all builds #2800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[run]
omit =
# standlonetemplate is read dynamically and tested by test_genscript
*standalonetemplate.py
source = _pytest,testing
parallel = 1
35 changes: 29 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ install:
- pip install --upgrade --pre tox
env:
matrix:
# coveralls is not listed in tox's envlist, but should run in travis
- TOXENV=coveralls
# note: please use "tox --listenvs" to populate the build matrix below
# please remove the linting env in all cases
- TOXENV=py27-pexpect
Expand All @@ -27,15 +25,16 @@ env:
- TOXENV=py36-pluggymaster
- TOXENV=py27-nobyte
- TOXENV=doctesting
- TOXENV=docs
- TOXENV=docs PYTEST_NO_COVERAGE=1

jobs:
include:
- env: TOXENV=pypy
# Coverage tracking is slow with pypy, skip it.
- env: TOXENV=pypy PYTEST_NO_COVERAGE=1
python: 'pypy-5.4'
- env: TOXENV=py35
python: '3.5'
- env: TOXENV=py36-freeze
- env: TOXENV=py36-freeze PYTEST_NO_COVERAGE=1
python: '3.6'
- env: TOXENV=py37
python: '3.7'
Expand All @@ -61,7 +60,7 @@ jobs:
env: TOXENV=py27
- env: TOXENV=py34
- env: TOXENV=py36
- env: TOXENV=linting
- env: TOXENV=linting PYTEST_NO_COVERAGE=1

- stage: deploy
python: '3.6'
Expand All @@ -79,8 +78,32 @@ jobs:
tags: true
repo: pytest-dev/pytest

before_script:
- |
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
export _PYTEST_TOX_COVERAGE_RUN="env COVERAGE_FILE=$PWD/.coverage COVERAGE_PROCESS_START=$PWD/.coveragerc coverage run --source {envsitepackagesdir}/_pytest/,$PWD/testing -m"
export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
fi

script: tox --recreate

after_success:
- |
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
set -e
pip install codecov
coverage combine
coverage xml
coverage report -m
codecov --required -X gcov pycov search -f coverage.xml --flags ${TOXENV//-/ }

# Coveralls does not support merged reports.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can drop coveralls then. Or would you rather do it in another PR @blueyed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've thought to keep it for comparison.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh OK. But I think we should remove it after a while to avoid confusion. 👍

if [[ "$TOXENV" = py37 ]]; then
pip install coveralls
coveralls
fi
fi

notifications:
irc:
channels:
Expand Down
49 changes: 33 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ envlist =
docs

[testenv]
commands = pytest --lsof -ra {posargs:testing}
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {env:_PYTEST_TEST_OPTS:} {posargs:testing}
coverage: coverage report -m --skip-covered
setenv =
coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m
coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
coverage: COVERAGE_FILE={toxinidir}/.coverage
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
passenv = USER USERNAME
deps =
hypothesis>=3.56
nose
mock
requests
{env:_PYTEST_TOX_EXTRA_DEP:}

[testenv:py27-subprocess]
changedir = .
Expand All @@ -47,9 +55,10 @@ deps =
mock
nose
hypothesis>=3.56
{env:_PYTEST_TOX_EXTRA_DEP:}
changedir=testing
commands =
pytest -n8 -ra {posargs:.}
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n8 -ra {posargs:.}

[testenv:py36-xdist]
deps = {[testenv:py27-xdist]deps}
Expand All @@ -58,9 +67,11 @@ commands = {[testenv:py27-xdist]commands}
[testenv:py27-pexpect]
changedir = testing
platform = linux|darwin
deps = pexpect
deps =
pexpect
{env:_PYTEST_TOX_EXTRA_DEP:}
commands =
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

[testenv:py36-pexpect]
changedir = {[testenv:py27-pexpect]changedir}
Expand All @@ -73,33 +84,40 @@ deps =
pytest-xdist>=1.13
hypothesis>=3.56
mock
{env:_PYTEST_TOX_EXTRA_DEP:}
distribute = true
changedir=testing
setenv =
{[testenv]setenv}
PYTHONDONTWRITEBYTECODE=1
commands =
pytest -n3 -ra {posargs:.}
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n3 -ra {posargs:.}

[testenv:py27-trial]
deps = twisted
deps =
twisted
{env:_PYTEST_TOX_EXTRA_DEP:}
commands =
pytest -ra {posargs:testing/test_unittest.py}
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/test_unittest.py}

[testenv:py36-trial]
deps = {[testenv:py27-trial]deps}
commands = {[testenv:py27-trial]commands}

[testenv:py27-numpy]
deps = numpy
deps =
numpy
{env:_PYTEST_TOX_EXTRA_DEP:}
commands=
pytest -ra {posargs:testing/python/approx.py}
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/python/approx.py}

[testenv:py36-numpy]
deps = {[testenv:py27-numpy]deps}
commands = {[testenv:py27-numpy]commands}

[testenv:py27-pluggymaster]
setenv=
{[testenv]setenv}
_PYTEST_SETUP_SKIP_PLUGGY_DEP=1
deps =
{[testenv]deps}
Expand All @@ -123,15 +141,13 @@ commands =

[testenv:doctesting]
basepython = python
usedevelop = True
skipsdist = True
# ensure the given pyargs can't mean anything else
changedir = doc/
deps =
PyYAML
{env:_PYTEST_TOX_EXTRA_DEP:}
commands =
pytest -ra en
pytest --doctest-modules --pyargs _pytest
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra doc/en
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest

[testenv:regen]
changedir = doc/en
Expand All @@ -155,7 +171,8 @@ commands =

[testenv:py36-freeze]
changedir = testing/freeze
deps = pyinstaller
deps =
pyinstaller
commands =
{envpython} create_executable.py
{envpython} tox_run.py
Expand All @@ -170,7 +187,7 @@ deps =
coveralls
codecov
commands =
coverage run --source=_pytest -m pytest testing
coverage run -m pytest testing
coverage report -m
coveralls
codecov
Expand Down