pytest-cov icon indicating copy to clipboard operation
pytest-cov copied to clipboard

locking the coverage file before use

Open notestaff opened this issue 7 years ago • 4 comments

Maybe, lock the coverage data file with something like https://pypi.org/project/filelock/ before reading/writing it? When using pytest-cov on Travis-CI with --cov-append, several jobs from the job matrix might be using the file concurrently.

notestaff avatar Jul 31 '18 15:07 notestaff

Wouldn't the jobs run in separate containers/vms?

ionelmc avatar Aug 08 '18 13:08 ionelmc

travis jobs run in separate containers/vm's

RonnyPfannschmidt avatar Aug 08 '18 13:08 RonnyPfannschmidt

also note that coverage has a multi-process mode that works correct - its based on adding pids to coverage files and combining after runs, since anything else does not work without blocking

RonnyPfannschmidt avatar Aug 08 '18 13:08 RonnyPfannschmidt

Using a distinct COVERAGE_FILE per worker should help, see: https://github.com/nedbat/coveragepy/issues/883#issuecomment-650562896

JulienPalard avatar Jun 27 '20 17:06 JulienPalard