aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-07-03 02:54:32 -0400
committerJason R. Coombs <jaraco@jaraco.com>2020-07-12 12:00:28 -0400
commit9f47efe757762351ec12b4303e747ac0774db991 (patch)
tree6e01afc19b5ca8bcefcad8096d09999ca03e8e6e
parentc897b90cbcd2d5a907d3b677f7229c2be7c44528 (diff)
downloadexternal_python_setuptools-9f47efe757762351ec12b4303e747ac0774db991.tar.gz
external_python_setuptools-9f47efe757762351ec12b4303e747ac0774db991.tar.bz2
external_python_setuptools-9f47efe757762351ec12b4303e747ac0774db991.zip
Programmatically disable coverage when running on PyPy.
-rw-r--r--conftest.py18
-rw-r--r--tox.ini4
2 files changed, 18 insertions, 4 deletions
diff --git a/conftest.py b/conftest.py
index 1746bfb5..0bc8d320 100644
--- a/conftest.py
+++ b/conftest.py
@@ -17,6 +17,24 @@ collect_ignore = [
]
+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')
diff --git a/tox.ini b/tox.ini
index 59213e88..9ce5cb5c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -29,10 +29,6 @@ extras =
tests
-[testenv:pypy{,3}]
-commands = pytest --no-cov {posargs}
-
-
[testenv:coverage]
description=Combine coverage data and create report
deps=coverage