-
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
Error combining coverage when running with pytest-xdist and a custom coverage plugin #642
Comments
I don't have a solution to the problem, but I'm curious what your custom plugin does for Python files? |
It tries to address what is also reported as nedbat/coveragepy#856: Find calls to functions that were compiled by TensorFlow's autograph functionality, and report the original function as covered. |
Interesting! Keep me posted on the progress. |
I have created an test for this but can't reproduce the problem: b9c99e7 Perhaps it's not enough to have an empty plugin and needs a custom tracer or something? I need a plugin that can reproduce the problem. |
Summary
I am working on a custom coverage plugin that returns custom file tracers for Python files. When I use this coverage plugin together with pytest-xdist, it fails when combining the coverage data from the xdist workers (see traceback below).
To debug this, I added
keep=True
to the calls toCoverage.combine
inpytest_cov/engine.py
.In an example with three xdist workers:
.coverage.*
files are created: one from each worker proceses, and one from the master process.When combining the coverage files, coverage checks if the "tracer" entries of all coverage files match. If a file is listed in the "files" table, but does not have an entry in the "tracer" table, it uses "" as the default tracer. This conflicts with the "tracer" info from the other data files, which causes coverage to error out.
To resolve this issue,
pytest-cov
could not create that extra, empty coverage data file from the master process.Traceback
Versions
Python 3.10.11 on Windows
The same also fails on Linux with the same package versions.
Config
pytest
is run viapython -m pytest --cov --cov-config=pyproject.toml -v --numprocesses=3 --maxschedchunk=1
.coverage
is configured as follows:The text was updated successfully, but these errors were encountered: