coveragepy
coveragepy copied to clipboard
coverage report data written not collected when using contextlib.chdir with multiprocessing
Describe the bug coverage report data written not collected when using contextlib.chdir with multiprocessing, Coverage writes data relative to the cwd, but I think the parent process should compute an absolute path to the coverage data directory and then proceed to use that in subprocesses
To Reproduce How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
- What version of Python are you using? 3.12
- What version of coverage.py shows the problem? The output of
coverage debug sysis helpful. 7.6.1 - What versions of what packages do you have installed? The output of
pip freezeis helpful. just coverage - What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix. https://gist.github.com/graingert/71ff2fb371a5538df740bc76eedcbdee
- What commands should we run to reproduce the problem? Be specific. Include everything, even
git clone,pip install, and so on. Explain like we're five!
git clone [email protected]:71ff2fb371a5538df740bc76eedcbdee.git
python3.12 -m venv .venv
source ./venv/bin/activate
pip install coverage
coverage run demo.py
coverage combine
coverage report -m
Expected behavior should see 100% coverage
Additional context this is also causes problems when I'm collecting coverage, creating a tmp folder for my sut process to write to, then using chdir/multiprocessing and seeing that .coverage file in my tmp folder