Open webknjaz opened 10 months ago
I just noticed that there's a feature to suppress warnings that have unique identifiers @ https://coverage.readthedocs.io/en/latest/cmd.html#warnings. But this specific warning isn't listed there.
I located the _warn()
call @ https://github.com/nedbat/coveragepy/blob/184dc78/coverage/control.py#L562-L569 and realized that it doesn't pass a slug=
argument. I suppose it could be useful to set it as well.
Is your feature request related to a problem? Please describe.
I'm integrating
Cython.Coverage
in the @aio-libs projects. It works fine for CPython but crashes on PyPy. This is becauseCoverageWarning
is emitted and pytest is configured withfilterwarnings = error
(coveragepy is integrated through pytest-cov).In projects, where we use Cython, we normally maintain a fallback pure-python implementation. So in CI we run tests with and without C-extensions to cover these cases.
Cython.Coverage
is added to.coveragerc
statically and gets picked up even when we test pure-python builds. That works fine on CPython, there's just no matches for PYX files since they aren't measured. It explodes on PyPy, though. For PyPy, we always disable building C-extensions, so it's always pure-python.But since the config is static, and the plugin is needed for other envs, we're stuck with coveragepy picking it up when it's undesired.
Describe the solution you'd like
I think, there's a need for dynamically enabling and disabling plugins:
pytest-cov
could integrate it seamlessly)Describe alternatives you've considered
$PYTHONPATH
and auto-injecting that on PyPy, using some wrapper.sed -i 's/^plugins = .*//g'
in CI.Additional context The failing CI job: https://github.com/aio-libs/yarl/actions/runs/6971527253/job/18972275042?pr=961#step:9:82
I extracted the traceback since GHA logs get garbage-collected over time: