@@ -30,24 +30,24 @@ def read(*names, **kwargs):


class BuildWithPTH(build):
def run(self):
build.run(self)
def run(self, *args, **kwargs):
build.run(self, *args, **kwargs)
path = join(dirname(__file__), 'src', 'pytest-cov.pth')
dest = join(self.build_lib, basename(path))
self.copy_file(path, dest)


class EasyInstallWithPTH(easy_install):
def run(self):
easy_install.run(self)
def run(self, *args, **kwargs):
easy_install.run(self, *args, **kwargs)
path = join(dirname(__file__), 'src', 'pytest-cov.pth')
dest = join(self.install_dir, basename(path))
self.copy_file(path, dest)


class InstallLibWithPTH(install_lib):
def run(self):
install_lib.run(self)
def run(self, *args, **kwargs):
install_lib.run(self, *args, **kwargs)
path = join(dirname(__file__), 'src', 'pytest-cov.pth')
dest = join(self.install_dir, basename(path))
self.copy_file(path, dest)
@@ -58,8 +58,8 @@ def get_outputs(self):


class DevelopWithPTH(develop):
def run(self):
develop.run(self)
def run(self, *args, **kwargs):
develop.run(self, *args, **kwargs)
path = join(dirname(__file__), 'src', 'pytest-cov.pth')
dest = join(self.install_dir, basename(path))
self.copy_file(path, dest)
@@ -85,7 +85,7 @@ def run(self):

setup(
name='pytest-cov',
version='2.10.1',
version='2.11.1',
license='MIT',
description='Pytest plugin for measuring coverage.',
long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))),
@@ -124,7 +124,7 @@ def run(self):
],
install_requires=[
'pytest>=4.6',
'coverage>=4.4'
'coverage>=5.2.1'
],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
extras_require={
@@ -141,8 +141,6 @@ def run(self):
'pytest11': [
'pytest_cov = pytest_cov.plugin',
],
'console_scripts': [
]
},
cmdclass={
'build': BuildWithPTH,
@@ -1,2 +1,2 @@
"""pytest-cov: avoid already-imported warning: PYTEST_DONT_REWRITE."""
__version__ = "__version__ = '2.10.1'"
__version__ = "__version__ = '2.11.1'"
@@ -45,6 +45,7 @@ def init():
cov_config = os.environ.get('COV_CORE_CONFIG')
cov_datafile = os.environ.get('COV_CORE_DATAFILE')
cov_branch = True if os.environ.get('COV_CORE_BRANCH') == 'enabled' else None
cov_context = os.environ.get('COV_CORE_CONTEXT')

if cov_datafile:
if _active_cov:
@@ -71,6 +72,8 @@ def init():
)
cov.load()
cov.start()
if cov_context:
cov.switch_context(cov_context)
cov._warn_no_data = False
cov._warn_unimported_source = False
return cov
@@ -110,6 +110,7 @@ def unset_env():
os.environ.pop('COV_CORE_CONFIG', None)
os.environ.pop('COV_CORE_DATAFILE', None)
os.environ.pop('COV_CORE_BRANCH', None)
os.environ.pop('COV_CORE_CONTEXT', None)

@staticmethod
def get_node_desc(platform, version_info):
@@ -356,6 +356,7 @@ def pytest_runtest_call(self, item):
def switch_context(self, item, when):
context = "{item.nodeid}|{when}".format(item=item, when=when)
self.cov.switch_context(context)
os.environ['COV_CORE_CONTEXT'] = context


@pytest.fixture
@@ -1059,7 +1059,7 @@ def test_funcarg_not_active(testdir):
@pytest.mark.skipif("sys.version_info[0] < 3", reason="no context manager api on Python 2")
@pytest.mark.skipif('sys.platform == "win32"', reason="multiprocessing support is broken on Windows")
@pytest.mark.skipif('platform.python_implementation() == "PyPy"', reason="often deadlocks on PyPy")
@pytest.mark.skipif('sys.version_info[:2] == (3, 8)', reason="deadlocks on Python 3.8, see: https://bugs.python.org/issue38227")
@pytest.mark.skipif('sys.version_info[:2] >= (3, 8)', reason="deadlocks on Python 3.8+, see: https://bugs.python.org/issue38227")
def test_multiprocessing_pool(testdir):
pytest.importorskip('multiprocessing.util')

@@ -1100,7 +1100,7 @@ def test_run_target():

@pytest.mark.skipif('sys.platform == "win32"', reason="multiprocessing support is broken on Windows")
@pytest.mark.skipif('platform.python_implementation() == "PyPy"', reason="often deadlocks on PyPy")
@pytest.mark.skipif('sys.version_info[:2] == (3, 8)', reason="deadlocks on Python 3.8, see: https://bugs.python.org/issue38227")
@pytest.mark.skipif('sys.version_info[:2] >= (3, 8)', reason="deadlocks on Python 3.8, see: https://bugs.python.org/issue38227")
def test_multiprocessing_pool_terminate(testdir):
pytest.importorskip('multiprocessing.util')

@@ -1538,8 +1538,14 @@ def test_cover_looponfail(testdir, monkeypatch):
testdir.makeconftest(CONFTEST)
script = testdir.makepyfile(BASIC_TEST)

monkeypatch.setattr(testdir, 'run',
lambda *args, **kwargs: _TestProcess(*map(str, args)))
def mock_run(*args, **kwargs):
return _TestProcess(*map(str, args))

monkeypatch.setattr(testdir, 'run', mock_run)
assert testdir.run is mock_run
if hasattr(testdir, '_pytester'):
monkeypatch.setattr(testdir._pytester, 'run', mock_run)
assert testdir._pytester.run is mock_run
with testdir.runpytest('-v',
'--cov=%s' % script.dirpath(),
'--looponfail',
35 tox.ini
@@ -1,11 +1,21 @@
[testenv:bootstrap]
deps =
jinja2
matrix
tox
skip_install = true
commands =
python ci/bootstrap.py --no-env
passenv =
*
; a generative tox configuration, see: https://tox.readthedocs.io/en/latest/config.html#generative-envlist

[tox]
envlist =
check
py{27,35,36,37,py,py3}-pytest46-xdist27-coverage{45,52}
py{36,37,38,py3}-pytest{46,54}-xdist33-coverage{45,52}
py{36,37,38,py3}-pytest{60}-xdist200-coverage{52}
py{27,35,36,37,py,py3}-pytest46-xdist127-coverage{52,53}
py{36,37,38,py3}-pytest{46,54}-xdist133-coverage{53}
py{36,37,38,39,py3}-pytest{62}-xdist202-coverage{53}
docs

[testenv]
@@ -17,21 +27,26 @@ setenv =
pytest46: _DEP_PYTEST=pytest==4.6.10
pytest53: _DEP_PYTEST=pytest==5.3.2
pytest54: _DEP_PYTEST=pytest==5.4.3
pytest60: _DEP_PYTEST=pytest==6.0.1
pytest60: _DEP_PYTEST=pytest==6.0.2
pytest61: _DEP_PYTEST=pytest==6.1.2
pytest62: _DEP_PYTEST=pytest==6.2.1

xdist27: _DEP_PYTESTXDIST=pytest-xdist==1.27.0
xdist29: _DEP_PYTESTXDIST=pytest-xdist==1.29.0
xdist31: _DEP_PYTESTXDIST=pytest-xdist==1.31.0
xdist32: _DEP_PYTESTXDIST=pytest-xdist==1.32.0
xdist33: _DEP_PYTESTXDIST=pytest-xdist==1.33.0
xdist34: _DEP_PYTESTXDIST=pytest-xdist==1.34.0
xdist127: _DEP_PYTESTXDIST=pytest-xdist==1.27.0
xdist129: _DEP_PYTESTXDIST=pytest-xdist==1.29.0
xdist131: _DEP_PYTESTXDIST=pytest-xdist==1.31.0
xdist132: _DEP_PYTESTXDIST=pytest-xdist==1.32.0
xdist133: _DEP_PYTESTXDIST=pytest-xdist==1.33.0
xdist134: _DEP_PYTESTXDIST=pytest-xdist==1.34.0
xdist200: _DEP_PYTESTXDIST=pytest-xdist==2.0.0
xdist201: _DEP_PYTESTXDIST=pytest-xdist==2.1.0
xdist202: _DEP_PYTESTXDIST=pytest-xdist==2.2.0
xdistdev: _DEP_PYTESTXDIST=git+https://github.com/pytest-dev/pytest-xdist.git#egg=pytest-xdist

coverage45: _DEP_COVERAGE=coverage==4.5.4
coverage50: _DEP_COVERAGE=coverage==5.0.4
coverage51: _DEP_COVERAGE=coverage==5.1
coverage52: _DEP_COVERAGE=coverage==5.2.1
coverage53: _DEP_COVERAGE=coverage==5.3.1
# For testing against a coverage.py working tree.
coveragedev: _DEP_COVERAGE=-e{env:COVERAGE_HOME}
passenv =