Skip to content
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

coverage report data written not collected when using contextlib.chdir with multiprocessing #1867

Open
graingert opened this issue Oct 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@graingert
Copy link
Contributor

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:

  1. What version of Python are you using? 3.12
  2. What version of coverage.py shows the problem? The output of coverage debug sys is helpful. 7.6.1
  3. What versions of what packages do you have installed? The output of pip freeze is helpful. just coverage
  4. 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
  5. 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

@graingert graingert added the bug Something isn't working label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant