ci: revisit coverage reporting

This brings coverage back that got missing with 9dcd6f2.

Continuation of #4839 / #4846.
This commit is contained in:
Daniel Hahler 2019-03-01 14:55:09 +01:00
parent bd2c9bedcf
commit 8481e438bd
3 changed files with 89 additions and 57 deletions

View File

@ -10,24 +10,38 @@ python:
- '3.7' - '3.7'
install: install:
- python -m pip install --upgrade --pre tox - python -m pip install --upgrade --pre tox
env:
matrix:
- TOXENV=py27 PYTEST_COVERAGE=1
# Specialized factors for py27.
- TOXENV=py27-nobyte-numpy-xdist PYTEST_COVERAGE=1
- TOXENV=py27-pluggymaster-xdist
# Specialized factors for py37.
- TOXENV=py37-pexpect,py37-trial
- TOXENV=py37-pluggymaster-xdist
- TOXENV=py37-freeze
matrix:
allow_failures:
- python: '3.8-dev'
env: TOXENV=py38-xdist
jobs: jobs:
include: include:
# OSX tests - first (in test stage), since they are the slower ones.
- &test-macos
# NOTE: (tests with) pexpect appear to be buggy on Travis,
# at least with coverage.
# Log: https://travis-ci.org/pytest-dev/pytest/jobs/500358864
os: osx
osx_image: xcode10.1
language: generic
# Coverage for:
# - py2 with symlink in test_cmdline_python_package_symlink.
env: TOXENV=py27-xdist PYTEST_COVERAGE=1
before_install:
- python -V
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27
- <<: *test-macos
env: TOXENV=py37-xdist
before_install:
- which python3
- python3 -V
- ln -sfn "$(which python3)" /usr/local/bin/python
- python -V
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37
# Full run of latest (major) supported versions, without xdist.
- env: TOXENV=py27
python: '2.7'
- env: TOXENV=py37
python: '3.7'
# Coverage tracking is slow with pypy, skip it. # Coverage tracking is slow with pypy, skip it.
- env: TOXENV=pypy-xdist - env: TOXENV=pypy-xdist
python: 'pypy2.7-6.0' python: 'pypy2.7-6.0'
@ -38,25 +52,25 @@ jobs:
python: '3.4' python: '3.4'
- env: TOXENV=py35-xdist - env: TOXENV=py35-xdist
python: '3.5' python: '3.5'
- env: TOXENV=py36-xdist
python: '3.6' # Coverage for:
- env: TOXENV=py37 # - pytester's LsofFdLeakChecker
- &test-macos # - TestArgComplete (linux only)
os: osx # - numpy
osx_image: xcode10.1 - env: TOXENV=py37-lsof-numpy-xdist PYTEST_COVERAGE=1
language: generic
before_install: # Specialized factors for py27.
- python -V - env: TOXENV=py27-nobyte-numpy-xdist
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 python: '2.7'
env: TOXENV=py27-xdist - env: TOXENV=py27-pluggymaster-xdist
- <<: *test-macos python: '2.7'
env: TOXENV=py37-xdist
before_install: # Specialized factors for py37.
- which python3 # Coverage for:
- python3 -V # - test_sys_breakpoint_interception (via pexpect).
- ln -sfn "$(which python3)" /usr/local/bin/python - env: TOXENV=py37-pexpect,py37-trial PYTEST_COVERAGE=1
- python -V - env: TOXENV=py37-pluggymaster-xdist
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - env: TOXENV=py37-freeze
# Jobs only run via Travis cron jobs (currently daily). # Jobs only run via Travis cron jobs (currently daily).
- env: TOXENV=py38-xdist - env: TOXENV=py38-xdist
@ -64,10 +78,14 @@ jobs:
if: type = cron if: type = cron
- stage: baseline - stage: baseline
env: TOXENV=py27-pexpect,py27-trial # Coverage for:
- env: TOXENV=py37-lsof-numpy-xdist PYTEST_COVERAGE=1 # - _pytest.unittest._handle_skip (via pexpect).
- env: TOXENV=linting,docs,doctesting env: TOXENV=py27-pexpect,py27-trial PYTEST_COVERAGE=1
python: '3.7' python: '2.7'
# Use py36 here for faster baseline.
- env: TOXENV=py36-xdist
python: '3.6'
- env: TOXENV=linting,docs,doctesting PYTEST_COVERAGE=1
- stage: deploy - stage: deploy
python: '3.6' python: '3.6'
@ -84,6 +102,11 @@ jobs:
tags: true tags: true
repo: pytest-dev/pytest repo: pytest-dev/pytest
matrix:
allow_failures:
- python: '3.8-dev'
env: TOXENV=py38-xdist
before_script: before_script:
- | - |
# Do not (re-)upload coverage with cron runs. # Do not (re-)upload coverage with cron runs.
@ -109,7 +132,7 @@ after_success:
coverage combine coverage combine
coverage xml coverage xml
coverage report -m coverage report -m
bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -n $TOXENV bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -n $TOXENV-$TRAVIS_OS_NAME
fi fi
notifications: notifications:

View File

@ -20,19 +20,28 @@ jobs:
py27: py27:
python.version: '2.7' python.version: '2.7'
tox.env: 'py27' tox.env: 'py27'
PYTEST_COVERAGE: '1' py27-nobyte-lsof-numpy:
py27-nobyte-numpy-xdist:
python.version: '2.7' python.version: '2.7'
tox.env: 'py27-nobyte-numpy-xdist' tox.env: 'py27-lsof-nobyte-numpy'
# Coverage for:
# - test_supports_breakpoint_module_global
# - test_terminal_reporter_writer_attr (without xdist)
# - "if write" branch in _pytest.assertion.rewrite
# - numpy
# - pytester's LsofFdLeakChecker (being skipped)
PYTEST_COVERAGE: '1' PYTEST_COVERAGE: '1'
py27-trial: py27-trial:
python.version: '2.7' python.version: '2.7'
tox.env: 'py27-trial' tox.env: 'py27-trial'
python.needs_vc: True python.needs_vc: True
PYTEST_COVERAGE: '1'
py27-pluggymaster-xdist: py27-pluggymaster-xdist:
python.version: '2.7' python.version: '2.7'
tox.env: 'py27-pluggymaster-xdist' tox.env: 'py27-pluggymaster-xdist'
# Coverage for:
# - except-IOError in _attempt_to_close_capture_file for py2.
# Also seen with py27-nobyte (using xdist), and py27-xdist.
# But no exception with py27-pexpect,py27-trial,py27-numpy.
PYTEST_COVERAGE: '1'
pypy: pypy:
python.version: 'pypy' python.version: 'pypy'
tox.env: 'pypy' tox.env: 'pypy'
@ -42,33 +51,34 @@ jobs:
# python.version: 'pypy3' # python.version: 'pypy3'
# tox.env: 'pypy3' # tox.env: 'pypy3'
# python.exe: 'pypy3' # python.exe: 'pypy3'
py34: py34-xdist:
python.version: '3.4' python.version: '3.4'
tox.env: 'py34' tox.env: 'py34-xdist'
# Coverage for:
# - _pytest.compat._bytes_to_ascii
PYTEST_COVERAGE: '1' PYTEST_COVERAGE: '1'
py35: py35-xdist:
python.version: '3.5' python.version: '3.5'
tox.env: 'py35' tox.env: 'py35-xdist'
# Coverage for:
# - test_supports_breakpoint_module_global
PYTEST_COVERAGE: '1' PYTEST_COVERAGE: '1'
py36: py36-xdist:
python.version: '3.6' python.version: '3.6'
tox.env: 'py36' tox.env: 'py36-xdist'
PYTEST_COVERAGE: '1'
py37: py37:
python.version: '3.7' python.version: '3.7'
tox.env: 'py37' tox.env: 'py37'
# Coverage for:
# - _py36_windowsconsoleio_workaround (with py36+)
# - test_request_garbage (no xdist)
PYTEST_COVERAGE: '1' PYTEST_COVERAGE: '1'
py37-linting/docs/doctesting: py37-linting/docs/doctesting:
python.version: '3.7' python.version: '3.7'
tox.env: 'linting,docs,doctesting' tox.env: 'linting,docs,doctesting'
py37-xdist:
python.version: '3.7'
tox.env: 'py37-xdist'
PYTEST_COVERAGE: '1'
py37-trial/numpy: py37-trial/numpy:
python.version: '3.7' python.version: '3.7'
tox.env: 'py37-trial,py37-numpy' tox.env: 'py37-trial,py37-numpy'
PYTEST_COVERAGE: '1'
py37-pluggymaster-xdist: py37-pluggymaster-xdist:
python.version: '3.7' python.version: '3.7'
tox.env: 'py37-pluggymaster-xdist' tox.env: 'py37-pluggymaster-xdist'

View File

@ -1313,8 +1313,7 @@ class TestEarlyRewriteBailout(object):
# always (previously triggered via xdist only). # always (previously triggered via xdist only).
# Ref: https://github.com/pytest-dev/py/pull/207 # Ref: https://github.com/pytest-dev/py/pull/207
monkeypatch.setattr(sys, "path", [""] + sys.path) monkeypatch.setattr(sys, "path", [""] + sys.path)
if "pathlib" in sys.modules: monkeypatch.delitem(sys.modules, "pathlib", raising=False)
del sys.modules["pathlib"]
testdir.makepyfile( testdir.makepyfile(
**{ **{