-
-
Notifications
You must be signed in to change notification settings - Fork 474
Description
Describe the bug
Running tests in parallel and comining the results afterwards using coverage combine can lead to a Permission denied while trying to read one of the previously created .coverage... files.
Traceback
Traceback (most recent call last):
File "/.../zdaemon/.tox/coverage/bin/coverage", line 10, in <module>
sys.exit(main())
^^^^^^
File "/.../zdaemon/.tox/coverage/lib/python3.11/site-packages/coverage/cmdline.py", line 1141, in main
status = CoverageScript().command_line(argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../zdaemon/.tox/coverage/lib/python3.11/site-packages/coverage/cmdline.py", line 841, in command_line
self.coverage.combine(data_paths, strict=True, keep=bool(options.keep))
File "/.../zdaemon/.tox/coverage/lib/python3.11/site-packages/coverage/control.py", line 906, in combine
combine_parallel_data(
File "/.../zdaemon/.tox/coverage/lib/python3.11/site-packages/coverage/data.py", line 162, in combine_parallel_data
with open(f, "rb") as fobj:
^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/.../zdaemon/.coverage.echo-6.local.49253.XxJfFKGx'
I traced down the version needed for this issue to happen to version 7.12.1b1 and newer.
To Reproduce
I have no idea (yet) how to reproduce it but the diff of version 7.12.1b1 to the previous one is not too big and maybe this report already rings a bell.
For now I only have a failing CI job as a reference: https://github.com/zopefoundation/zdaemon/actions/runs/20894903261/job/60031864188
Answer the questions below:
- What version of Python are you using? 3.11, 3.12
- What version of coverage.py shows the problem? 7.12.1b1 and newer
- The output of
coverage debug sysis helpful.
coverage debug sys
-- sys -------------------------------------------------------
coverage_version: 7.12.1b1
coverage_module: /.../zdaemon/.tox/coverage/lib/python3.11/site-packages/coverage/__init__.py
core: -none-
CTracer: available from /.../zdaemon/.tox/coverage/lib/python3.11/site-packages/coverage/tracer.cpython-311-darwin.so
plugins.file_tracers: -none-
plugins.configurers: -none-
plugins.context_switchers: -none-
configs_attempted: /.../zdaemon/.coveragerc
/.../zdaemon/setup.cfg
/.../zdaemon/tox.ini
/.../zdaemon/pyproject.toml
configs_read: /.../zdaemon/setup.cfg
/.../zdaemon/tox.ini
/.../zdaemon/pyproject.toml
config_file: /.../zdaemon/pyproject.toml
config_contents: b'# Generated with zope.meta (https://zopemeta.readthedocs.io/) from:\n# https://github.com/zopefoundation/meta/tree/master/src/zope/meta/buildout-recipe\n#\n# Generated from:\n# https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe\n\n[build-system]\nrequires = [\n "setuptools >= 78.1.1,< 81",\n "wheel",\n]\nbuild-backend = "setuptools.build_meta"\n\n[tool.coverage.run]\nbranch = true\nsource = ["zdaemon"]\nparallel = true\ndata_file = "$COVERAGE_HOME.coverage"\nomit = ["*/__main__.py"]\n\n[tool.coverage.report]\nfail_under = 79\nprecision = 2\nignore_errors = true\nshow_missing = true\nexclude_lines = [\n "pragma: no cover",\n "pragma: nocover",\n "except ImportError:",\n "raise NotImplementedError",\n "if __name__ == \'__main__\':",\n "self.fail",\n "raise AssertionError",\n "raise unittest.Skip",\n]\n\n[tool.coverage.html]\ndirectory = "parts/htmlcov"\n\n[tool.coverage.paths]\nsource = [\n "src/",\n ".tox/*/lib/python*/site-packages/",\n ".tox/pypy*/site-packages/",\n]\n'
data_file: -none-
python: 3.11.14 (main, Oct 11 2025, 02:11:58) [Clang 17.0.0 (clang-1700.3.19.1)]
platform: macOS-26.2-arm64-arm-64bit
implementation: CPython
build: main
Oct 11 2025 02:11:58
gil_enabled: True
executable: /.../zdaemon/.tox/coverage/bin/python3
def_encoding: utf-8
fs_encoding: utf-8
pid: 67863
cwd: /.../zdaemon
path: /.../zdaemon/.tox/coverage/bin
/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python311.zip
/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload
/.../zdaemon/.tox/coverage/lib/python3.11/site-packages
/.../zdaemon/src
environment: HOME = /Users/m.howitz
command_line: ./.tox/coverage/bin/coverage debug sys
time: 2026-01-14 17:04:58
pip freeze
coverage==7.12.1b1
manuel==1.13.0
setuptools==80.9.0
zc.customdoctests==1.0.1
ZConfig==4.3
zdaemon @ file:///.../zdaemon/.tox/.tmp/package/106/zdaemon-5.3.dev0-0.editable-py3-none-any.whl#sha256=34aef2af782542507f8ac1a6e4d9f20c860ab0187ee53d8db675c66b87e2de64
zope.exceptions==6.0
zope.interface==8.2
zope.testing==6.1
zope.testrunner==8.1
- What code shows the problem? It is happening on
master, commit2996a8c02f8af214431a8ef096112ba18d4909a9(the last one there, which is from 6 month ago) - What commands should we run to reproduce the problem?
git clone git@github.com:zopefoundation/zdaemoncd zdaemongit checkout 2996a8c02f8af214431a8ef096112ba18d4909a9python3.11 -m venv .venv.venv/bin/pip install tox.venv/bin/tox -ecoverage
Expected behavior
Successful coverage combine after the test run.
Additional context
Problem occurs on MacOS (locally) as well as on Ubuntu (GitHub Actions).