Skip to content

Commit

Permalink
Merge pull request #2254 from pypa/better-cov
Browse files Browse the repository at this point in the history
Programmatically disable coverage when running on PyPy.
  • Loading branch information
jaraco authored Jul 12, 2020
2 parents a494597 + 9f47efe commit 3319bfa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
18 changes: 18 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ def pytest_addoption(parser):
]


def pytest_configure(config):
disable_coverage_on_pypy(config)


def disable_coverage_on_pypy(config):
"""
Coverage makes tests on PyPy unbearably slow, so disable it.
"""
if '__pypy__' not in sys.builtin_module_names:
return

# Recommended at pytest-dev/pytest-cov#418
cov = config.pluginmanager.get_plugin('_cov')
cov.options.no_cov = True
if cov.cov_controller:
cov.cov_controller.pause()


if sys.version_info < (3,):
collect_ignore.append('setuptools/lib2to3_ex.py')
collect_ignore.append('setuptools/_imp.py')
Expand Down
4 changes: 0 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ extras =
tests


[testenv:pypy{,3}]
commands = pytest --no-cov {posargs}


[testenv:coverage]
description=Combine coverage data and create report
deps=coverage
Expand Down

0 comments on commit 3319bfa

Please sign in to comment.