Skip to content
70 changes: 30 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ stages:
- lint
- examples
- tests
matrix:
fast_finish: true
allow_failures:
- python: '3.8-dev'
jobs:
include:
- stage: lint
Expand All @@ -19,62 +23,48 @@ jobs:
- stage: tests
env: TOXENV=py27-pytest310-xdist27-coverage45
python: '2.7'
- env: TOXENV=py27-pytest43-xdist27-coverage45
python: '2.7'
- env: TOXENV=py27-pytest44-xdist28-coverage45
python: '2.7'
- env: TOXENV=py27-pytest45-xdist28-coverage45
- env: TOXENV=py27-pytest46-xdist27-coverage45
python: '2.7'
- env: TOXENV=py34-pytest310-xdist27-coverage45
python: '3.4'
- env: TOXENV=py34-pytest43-xdist27-coverage45
python: '3.4'
- env: TOXENV=py34-pytest44-xdist28-coverage45
python: '3.4'
- env: TOXENV=py34-pytest45-xdist28-coverage45
- env: TOXENV=py34-pytest46-xdist27-coverage45
python: '3.4'
- env: TOXENV=py35-pytest310-xdist27-coverage45
python: '3.5'
- env: TOXENV=py35-pytest43-xdist27-coverage45
python: '3.5'
- env: TOXENV=py35-pytest44-xdist28-coverage45
python: '3.5'
- env: TOXENV=py35-pytest45-xdist28-coverage45
- env: TOXENV=py35-pytest46-xdist27-coverage45
python: '3.5'
- env: TOXENV=py36-pytest310-xdist27-coverage45
python: '3.6'
- env: TOXENV=py36-pytest43-xdist27-coverage45
python: '3.6'
- env: TOXENV=py36-pytest44-xdist28-coverage45
python: '3.6'
- env: TOXENV=py36-pytest45-xdist28-coverage45
- env: TOXENV=py36-pytest46-xdist27-coverage45
python: '3.6'
- env: TOXENV=py37-pytest310-xdist27-coverage45
python: '3.7'
- env: TOXENV=py37-pytest43-xdist27-coverage45
python: '3.7'
- env: TOXENV=py37-pytest44-xdist28-coverage45
python: '3.7'
- env: TOXENV=py37-pytest45-xdist28-coverage45
- env: TOXENV=py37-pytest46-xdist27-coverage45
python: '3.7'
- env: TOXENV=pypy-pytest310-xdist27-coverage45
python: 'pypy2.7-6.0'
- env: TOXENV=pypy-pytest43-xdist27-coverage45
python: 'pypy2.7-6.0'
- env: TOXENV=pypy-pytest44-xdist28-coverage45
python: 'pypy2.7-6.0'
- env: TOXENV=pypy-pytest45-xdist28-coverage45
python: 'pypy2.7-6.0'
python: 'pypy'
- env: TOXENV=pypy-pytest46-xdist27-coverage45
python: 'pypy'
- env: TOXENV=pypy3-pytest310-xdist27-coverage45
python: 'pypy3.5-6.0'
- env: TOXENV=pypy3-pytest43-xdist27-coverage45
python: 'pypy3.5-6.0'
- env: TOXENV=pypy3-pytest44-xdist28-coverage45
python: 'pypy3.5-6.0'
- env: TOXENV=pypy3-pytest45-xdist28-coverage45
python: 'pypy3.5-6.0'
- env: TOXENV=py37-pytest310-xdist22-coverage45
python: 'pypy3'
- env: TOXENV=pypy3-pytest46-xdist27-coverage45
python: 'pypy3'
- env: TOXENV=py36-pytest46-xdist29-coverage45
python: '3.6'
- env: TOXENV=py36-pytest51-xdist29-coverage45
python: '3.6'
- env: TOXENV=py37-pytest46-xdist29-coverage45
python: '3.7'
- env: TOXENV=py37-pytest51-xdist29-coverage45
python: '3.7'
- env: TOXENV=py38-pytest46-xdist29-coverage45
python: '3.8-dev'
- env: TOXENV=py38-pytest51-xdist29-coverage45
python: '3.8-dev'
- env: TOXENV=pypy3-pytest46-xdist29-coverage45
python: 'pypy3'
- env: TOXENV=pypy3-pytest51-xdist29-coverage45
python: 'pypy3'

- stage: examples
python: '3.6'
Expand Down
13 changes: 8 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ build: off
environment:
matrix:
- TOXENV: check
- TOXENV: 'py27-pytest310-xdist27-coverage45,py27-pytest43-xdist27-coverage45,py27-pytest44-xdist28-coverage45,py27-pytest45-xdist28-coverage45'
- TOXENV: 'py34-pytest310-xdist27-coverage45,py34-pytest43-xdist27-coverage45,py34-pytest44-xdist28-coverage45,py34-pytest45-xdist28-coverage45'
- TOXENV: 'py35-pytest310-xdist27-coverage45,py35-pytest43-xdist27-coverage45,py35-pytest44-xdist28-coverage45,py35-pytest45-xdist28-coverage45'
- TOXENV: 'pypy-pytest310-xdist27-coverage45,pypy-pytest43-xdist27-coverage45,pypy-pytest44-xdist28-coverage45,pypy-pytest45-xdist28-coverage45'
- TOXENV: 'py27-pytest310-xdist27-coverage45,py27-pytest46-xdist27-coverage45'
- TOXENV: 'py34-pytest310-xdist27-coverage45,py34-pytest46-xdist27-coverage45'
- TOXENV: 'py35-pytest310-xdist27-coverage45,py35-pytest46-xdist27-coverage45'
- TOXENV: 'py36-pytest310-xdist27-coverage45,py36-pytest46-xdist27-coverage45,py36-pytest46-xdist29-coverage45,py36-pytest51-xdist29-coverage45'
- TOXENV: 'py37-pytest310-xdist27-coverage45,py37-pytest46-xdist27-coverage45,py37-pytest46-xdist29-coverage45,py37-pytest51-xdist29-coverage45'
- TOXENV: 'pypy-pytest310-xdist27-coverage45,pypy-pytest46-xdist27-coverage45'

init:
- ps: echo $env:TOXENV
- ps: ls C:\Python*
install:
- IF "%TOXENV:~0,4%" == "pypy" choco install --no-progress python.pypy
- IF "%TOXENV:~0,5%" == "pypy-" choco install --no-progress python.pypy
- IF "%TOXENV:~0,6%" == "pypy3-" choco install --no-progress pypy3
- SET PATH=C:\tools\pypy\pypy;%PATH%
- C:\Python37\python -m pip install -U "virtualenv>=16.5.0"
- C:\Python37\python -m pip install tox
Expand Down
9 changes: 6 additions & 3 deletions ci/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import sys
from collections import defaultdict
from os.path import abspath
from os.path import dirname
from os.path import exists
Expand Down Expand Up @@ -50,9 +51,11 @@
]
tox_environments = [line for line in tox_environments if line not in ['clean', 'report', 'docs', 'check']]

template_vars = {'tox_environments': tox_environments}
for py_ver in '27 34 35 py'.split():
template_vars['py%s_environments' % py_ver] = [x for x in tox_environments if x.startswith('py' + py_ver + '-')]
template_vars = defaultdict(list)
template_vars['tox_environments'] = tox_environments
for env in tox_environments:
first, _ = env.split('-', 1)
template_vars['%s_environments' % first].append(env)

for name in os.listdir(join("ci", "templates")):
with open(join(base_path, name), "w") as fh:
Expand Down
10 changes: 8 additions & 2 deletions ci/templates/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ stages:
- lint
- examples
- tests
matrix:
fast_finish: true
allow_failures:
- python: '3.8-dev'
jobs:
include:
- stage: lint
Expand All @@ -20,9 +24,11 @@ jobs:
{%+ if not loop.first %}- {% else %} {% endif -%}
env: TOXENV={{ env }}
{% if env.startswith("pypy-") %}
python: 'pypy2.7-6.0'
python: 'pypy'
{% elif env.startswith("pypy3-") %}
python: 'pypy3.5-6.0'
python: 'pypy3'
{% elif env.startswith("py38-") %}
python: '3.8-dev'
{% else %}
python: '{{ "{0[2]}.{0[3]}".format(env) }}'
{% endif -%}
Expand Down
5 changes: 4 additions & 1 deletion ci/templates/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ environment:
- TOXENV: '{{ py27_environments|join(",") }}'
- TOXENV: '{{ py34_environments|join(",") }}'
- TOXENV: '{{ py35_environments|join(",") }}'
- TOXENV: '{{ py36_environments|join(",") }}'
- TOXENV: '{{ py37_environments|join(",") }}'
- TOXENV: '{{ pypy_environments|join(",") }}'

init:
- ps: echo $env:TOXENV
- ps: ls C:\Python*
install:
- IF "%TOXENV:~0,4%" == "pypy" choco install --no-progress python.pypy
- IF "%TOXENV:~0,5%" == "pypy-" choco install --no-progress python.pypy
- IF "%TOXENV:~0,6%" == "pypy3-" choco install --no-progress pypy3
- SET PATH=C:\tools\pypy\pypy;%PATH%
- C:\Python37\python -m pip install -U "virtualenv>=16.5.0"
- C:\Python37\python -m pip install tox
Expand Down
3 changes: 2 additions & 1 deletion src/pytest_cov/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ def cleanup():
_active_cov = None
_cleanup_in_progress = False
if _pending_signal:
pending_singal = _pending_signal
_pending_signal = None
_signal_cleanup_handler(*_pending_signal)
_signal_cleanup_handler(*pending_singal)


multiprocessing_finish = cleanup # in case someone dared to use this internal
Expand Down
11 changes: 11 additions & 0 deletions tests/test_pytest_cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ def test_fail(p):
result = testdir.runpytest('-v',
'--cov=%s' % script.dirpath(),
'--cov-fail-under=100',
'--cov-report=html',
script)

result.stdout.fnmatch_lines_random([
Expand Down Expand Up @@ -912,6 +913,7 @@ def test_dist_missing_data(testdir):
script = testdir.makepyfile(SCRIPT)

result = testdir.runpytest('-v',
'--assert=plain',
'--cov=%s' % script.dirpath(),
'--cov-report=term-missing',
'--dist=load',
Expand Down Expand Up @@ -1038,6 +1040,7 @@ def test_run_target():


@pytest.mark.skipif('sys.platform == "win32"', reason="multiprocessing support is broken on Windows")
@pytest.mark.skipif('sys.version_info[0] > 2 and platform.python_implementation() == "PyPy"', reason="broken on PyPy3")
def test_multiprocessing_pool_close(testdir):
pytest.importorskip('multiprocessing.util')

Expand Down Expand Up @@ -1295,6 +1298,7 @@ def test_run():
''')

result = testdir.runpytest('-vv',
'--assert=plain',
'--cov=%s' % script.dirpath(),
'--cov-report=term-missing',
script)
Expand Down Expand Up @@ -1333,6 +1337,7 @@ def test_run():
''')

result = testdir.runpytest('-vv',
'--assert=plain',
'--cov=%s' % script.dirpath(),
'--cov-report=term-missing',
script)
Expand Down Expand Up @@ -1375,6 +1380,7 @@ def test_run():
''')

result = testdir.runpytest('-vv',
'--assert=plain',
'--cov=%s' % script.dirpath(),
'--cov-report=term-missing',
script)
Expand Down Expand Up @@ -1631,6 +1637,7 @@ def test_dist_boxed(testdir):
script = testdir.makepyfile(SCRIPT_SIMPLE)

result = testdir.runpytest('-v',
'--assert=plain',
'--cov=%s' % script.dirpath(),
'--boxed',
script)
Expand All @@ -1644,6 +1651,8 @@ def test_dist_boxed(testdir):


@pytest.mark.skipif('sys.platform == "win32"')
@pytest.mark.skipif('sys.version_info[0] > 2 and platform.python_implementation() == "PyPy"',
reason="strange optimization on PyPy3")
def test_dist_bare_cov(testdir):
script = testdir.makepyfile(SCRIPT_SIMPLE)

Expand Down Expand Up @@ -1825,6 +1834,7 @@ def bad_init():
def test_double_cov(testdir):
script = testdir.makepyfile(SCRIPT_SIMPLE)
result = testdir.runpytest('-v',
'--assert=plain',
'--cov', '--cov=%s' % script.dirpath(),
script)

Expand All @@ -1839,6 +1849,7 @@ def test_double_cov(testdir):
def test_double_cov2(testdir):
script = testdir.makepyfile(SCRIPT_SIMPLE)
result = testdir.runpytest('-v',
'--assert=plain',
'--cov', '--cov',
script)

Expand Down
9 changes: 6 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
[tox]
envlist =
check
py{27,34,35,36,37,py,py3}-{pytest310-xdist27,pytest43-xdist27,pytest44-xdist28,pytest45-xdist28}-{coverage45}
py37-pytest310-xdist22-coverage45
py{27,34,35,36,37,py,py3}-pytest{310,46}-xdist27-{coverage45}
py{36,37,38,py3}-pytest{46,51}-xdist29-{coverage45}
docs

[testenv]
Expand All @@ -19,13 +19,16 @@ setenv =
pytest43: _DEP_PYTEST=pytest==4.3.1
pytest44: _DEP_PYTEST=pytest==4.4.2
pytest45: _DEP_PYTEST=pytest==4.5.0
pytest46: _DEP_PYTEST=pytest==4.6.5
pytest51: _DEP_PYTEST=pytest==5.1.0

xdist22: _DEP_PYTESTXDIST=pytest-xdist==1.22.0
xdist27: _DEP_PYTESTXDIST=pytest-xdist==1.27.0
xdist28: _DEP_PYTESTXDIST=pytest-xdist==1.28.0
xdist29: _DEP_PYTESTXDIST=pytest-xdist==1.29.0

coverage44: _DEP_COVERAGE=coverage==4.4.2
coverage45: _DEP_COVERAGE=coverage==4.5.3
coverage45: _DEP_COVERAGE=coverage==4.5.4

passenv =
*
Expand Down