A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nedbat/coveragepy/issues/2024 below:

`patch = subprocess` doesn't work when running multiple scripts in parallel · Issue #2024 · nedbat/coveragepy · GitHub

Describe the bug
When using some external tool to manage concurrent execution of Python scripts, patch = subprocess can miss some coverage.

To Reproduce

  1. Using Python 3.13 in github actions (ubuntu-latest) or locally on a linux system (debian trixie)
  2. clone https://github.com/jepler/covsub/actions and check out branch subprocess-parallel-make
  3. check that without concurrency 100% coverage is attained: make -j1
  4. check that with concurrency less than 100% coverage is attained: make -j10

Expected behavior
When make is used to run multiple coverage jobs in parallel, all Python code executed is recorded by coverage.

Additional context
While trying to understand #2022 I noticed that this mode creates and then deletes the subcover.pth file as the Python program was running. This made me wonder about the situation with sub-programs and sub-sub programs, and I created this demonstration with many parallel jobs and random delays to ensure the execution is staggered and takes a non-trivial amount of time.

I believe that what is happening is: python -mcoverage run instance 1 terminates, removing the subcover.pth file. python -mcoverage run instance 2 is still running, and creates a new subprocess. but this subprocess doesn't bring in coverage because subcover.pth has been removed.

This is not affecting me directly, it's just a problem I conjectured while learning the ins and outs of subprocess coverage.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4