diff --git a/.coveragerc b/.coveragerc new file mode 100644 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,4 @@ +[run] +concurrency = multiprocessing +parallel = true +sigterm = true diff --git a/swh/storage/tests/conftest.py b/swh/storage/tests/conftest.py --- a/swh/storage/tests/conftest.py +++ b/swh/storage/tests/conftest.py @@ -3,12 +3,14 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information +from distutils.version import LooseVersion import multiprocessing.util from hypothesis import HealthCheck, settings import pytest try: + import pytest_cov import pytest_cov.embed except ImportError: pytest_cov = None @@ -35,7 +37,9 @@ # This can still be overloaded via the --hypothesis-profile option. settings.load_profile("fast") -if pytest_cov is not None: +if pytest_cov is not None and LooseVersion(pytest_cov.__version__) < LooseVersion( + "4.0.0" +): # pytest_cov + multiprocessing can cause a segmentation fault when starting # the child process ; so we're # removing pytest-coverage's hook that runs when a child process starts. diff --git a/tox.ini b/tox.ini --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,7 @@ pytest \ !slow: --hypothesis-profile=fast \ slow: --hypothesis-profile=slow \ + --cov-config .coveragerc \ --cov={envsitepackagesdir}/swh/storage \ {envsitepackagesdir}/swh/storage \ --doctest-modules \