-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
no-data-collected under unix when using filterwarnings in pytest.ini #627
Comments
So you're saying using filterwarnings makes your coverage drop to 0%? Can't really help without a reproducer. |
Here’s a reproducer: https://github.com/flying-sheep/pytest-cov-filterwarnings As its readme says, the cause is that |
FWIW, I believe this is connected to #437 |
Ah yeah, seems like this issue is a duplicate of #437 then. As @ionelmc says in #635 (comment): This is a chicken-and-egg problem. Also pytest documents its plugin order: it loads builtin plugins first, e.g. the So I guess the only way to prevent that is to pass Now the question is, if we do that, can we re-enable it at runtime via |
Indeed it is. If you really must use this plugin see https://pytest-cov.readthedocs.io/en/latest/plugins.html |
Summary
First of all sorry for this incomplete bug report (no reproducer). Feel free to close it, but I figured it might still help somebody.
The problem is that the coverage data collection fails if the
filterwarnings
option inpytest.ini
is used to ignore a custom warning defined in our project, but only under Linux (Debian and Alpine) and Mac; it works fine under Windows with the nominally same conda environment and plugin versions, and it works fine as soon as the option is commented out.I sadly cannot tell you if/which additional conditions play into this.
Expected vs actual result
expected:
TOTAL 17353 5185 70%
actual:
TOTAL 17353 17353 0%
with this showing at the end of running the tests (or once for every worker if using
pytest-xdist
):Reproducer
Our pytest call:
where
XXX
is a subfolder of the working directory, and the top level of our package.Our
pytest.ini
:(some arguments are doubled/overridden because one is running in GitLab's CI/CD pipeline, while the
ini
is also used for local execution, but I played around with those options and they are not at fault)Our
.coveragerc
:Not a real reproducer, sorry, but I tried various different combinations of options (including disabling
xdist
), and the only thing that helped was commenting outfilterwarnings
.Versions
These versions are identical on the different systems (i.e., between the unix ones where this fails with
filterwarnings
active, and Windows, where it works).The problem is very likely also true for versions that are about a year old, because that was when we first encountered the problem (but thought it was an incompatibility with
xdist
).Config
tox.ini
is not used,setup.cfg
does not contain testing-related information, for the rest see aboveCode
Sorry, can't share our code, and didn't create a minimal example.
The text was updated successfully, but these errors were encountered: