-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in 2.6.0: running coverage combine after pytest-cov now errors out #222
Comments
to work around 'No data to combine error' The latest pytest-cov 2.6.0 seems to be running coverage combine itself: pytest-dev/pytest-cov#222 we may revert this later if we find a better solution
Yeah sorry, it was an unforeseen consequence of fixing the combining problems at the end of the run (#130). Unfortunately coverage 4.3 made Perhaps we could persuade @nedbat to revert that behavior, or have a config switch for it? |
Maybe we could save the coverage file with a suffix as a workaround (then combine wouldn't fail). For how many ppl is this regression a problem? |
It's not causing a problem for us anymore, though if you decide to switch back to requiring It does seem reasonable for pytest-cov to take care of this step in principle... it's one less obscure trick for people to learn. Maybe |
to work around 'No data to combine error' The latest pytest-cov 2.6.0 seems to be running coverage combine itself: pytest-dev/pytest-cov#222 we may revert this later if we find a better solution
to work around 'No data to combine error' The latest pytest-cov 2.6.0 seems to be running coverage combine itself: pytest-dev/pytest-cov#222 we may revert this later if we find a better solution
to work around 'No data to combine error' The latest pytest-cov 2.6.0 seems to be running coverage combine itself: pytest-dev/pytest-cov#222 we may revert this later if we find a better solution
to work around 'No data to combine error' The latest pytest-cov 2.6.0 seems to be running coverage combine itself: pytest-dev/pytest-cov#222 we may revert this later if we find a better solution
As you might expect, this is in a large distributed test suite. I've worked around it by adding I would like to get a small example of the behavior though, and I'm still working on that. |
This patch is a work-around for an issue with `pytest-cov`. For additional information, please see: pytest-dev/pytest-cov#222
Update: I was missing the Is the combining meant to happen always now? I'm a bit confused that the combining is not being done for me with 2.6.0.. .coveragerc: [run]
parallel = true
source = .
branch = true
[report]
include = pytest_django/*,pytest_django_test/*,tests/* tox.ini: setenv =
PYTHONPATH = {toxinidir}:{env:PYTHONPATH:}
COV_CORE_SOURCE={toxinidir}
COV_CORE_CONFIG={toxinidir}/.coveragerc
COV_CORE_DATAFILE={toxinidir}/.coverage.eager
passenv = PYTEST_ADDOPTS I set I have all of the (I am investigating why pytest-cov 2.6.0 causes coverage to drop on codecov for pytest-django by 74% (pytest-dev/pytest-django#650)) |
Just for reference: only a single/smaller |
Reverting the combining would make these tests fail:
@nedbat so I've looked over the code in coverage 4.5.2 - it looks like the problem lies in the fact that neither of these methods applies aliasing to the current data:
So if you want this change in pytest-cov reverted then please advise of a way to correctly apply aliasing to current data, or fix the Coverage object to apply full aliasing in either of those methods. |
This auto-combine is problematic when you have several runs of pytest (say across different versions of python) and want to combine them. Please at least add an option to prevent pytest-cov doing this combining. |
@cjw296 |
@ionelmc - I don't think it will. I run CI in docker containers, one for each python version, with Because each run with |
I'm having a similar issue. I run pytest with coverage multiple times and want to combine all results. If I don't use In both cases it's one more command to run for me, but I honestly prefer combining explicitly myself, it feels less magic 🙂 (I had to run experiments to be sure of what happens with or without |
Would a config solution as in #435 (setting a COVERAGE_FILE env var) solve the combining problems here? |
Something that that could be put in |
My take on this is that while pytest users tend to naturally gravitate to pytest-cov, it is actually not necessary and running coverage.py directly works just as well, and the whole setup has less moving parts https://coverage.readthedocs.io/en/stable/#quick-start. So, unless you need pytest-cov to achieve something specific, I suggest not to use it "just because we use pytest". |
We run coverage in
parallel=True
mode, because we have some tests that spawn subprocesses, and we want to capture coverage for all of them. To get a complete report for codecov, the CI does:As far as I know, this was mandatory on pytest-cov 2.5.1 and earlier. Since 2.6.0 came out yesterday, our tests have been failing because
coverage combine
saysNo data to combine
and it errors out, failing the test suite.I think this may be happening because pytest-cov is now effectively running
coverage combine
itself, so that instead of being mandatory to runcoverage combine
, it's now mandatory to not to runcoverage combine
? Possibly because of changes in #178? For now that seems to be working for us. But it'd be nice to confirm that our understanding is correct, and I figured you'd rather have a heads-up than not.Our bug: python-trio/trio#646
The text was updated successfully, but these errors were encountered: