-
Notifications
You must be signed in to change notification settings - Fork 211
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
pytest-cov + xdist + remote workers #232
Comments
I am using it myself with |
Interestingly, I've gotten it to report data inconsistently a few times now. All my successful samples so far have had EXECNET_DEBUG and PYTEST_DEBUG enabled for the master. My best guess is there's some kind of state I'm not accounting for (eg the report coverage file?), even though this is on CI and should have a clean working directory each time. The successful invocations look like:
I haven't noticed anything that stands out in the debug output so far. Forking pytest-cov and adding some debugging shows that the master is performing reasonably (eg it's running the distributed code and doesn't think it's colocated with the agent). Next I think I'll see if there's any difference when running on fresh machines, and look into getting debug output from the agents too (I think I need EXECNET_DEBUG=1 there because of how the socketserver swallows the subprocess output). |
Check if it works with 2.5.2. |
So far so good on 2.5.1. We're not interacting with coverage outside of pytest-cov. I still haven't managed to consistently reproduce failures or successes on 2.6.0. I was able to find a case where the coverage file stuck around after a build, but the next run (which succeeded) didn't run on that same host. |
I just debugged a similar problem; it looks like there's a bug in how pytest-cov combines coverage from remote workers where the code is installed at a different base path than on the master. There is code in pytest-cov to automatically build a Maybe the |
@jmbowman that line is like that to force coverage to reload the coverage data (fixes other issues). Not sure what's the bug - what unused code are you referring to? |
There is code when the master initializes and when each worker shuts down that ensures the configuration for |
So you're suggesting the paths aren't adjusted before saving the fist cov instance (that gets replaced)? |
@jmbowman |
@ionelmc Correct, the paths never get adjusted in the individual data files; coverage is always recorded with the actual paths used on the filesystem where the code is being run. The The bug can be worked around if you know all of the remote machine base paths ahead of time by putting the correct @blueyed Thanks for the tip! |
Our CI uses an xdist setup with remote tcp workers (
--tx socket=...
) to run a large test suite. As far as I can tell, pytest-cov supports this. But, when I use--cov=.
, the report only contains files/lines that (I suspect) are imported by the master process, such as our conftest. Running without xdist reports the expected coverage.So, before going too much further, I wanted to check: is this form of xdist supported? There are a few other issues, but they only refer to multi-process mode. If so, any ideas as to how I can go about debugging this? If not, any ideas on how I could still collect coverage with this configuration?
Here's some relevant package versions, in case it's helpful:
The text was updated successfully, but these errors were encountered: