pytest-dev / pytest-cov

Coverage plugin for pytest.
MIT License
1.76k stars 211 forks source link

Race condition in pytest-dev hangs coverage 6.3 #520

Open nedbat opened 2 years ago

nedbat commented 2 years ago

See https://github.com/nedbat/coveragepy/issues/1310 . Removing pytest-cov solves the problem. What is pytest-cov doing that causes this problem?

ionelmc commented 2 years ago

pytest-cov basically just forcibly enables coverage in multiprocess's subprocesses but that in turn just spurs problems caused by locks being shared between processes after a fork.

nedbat commented 2 years ago

I think I have seen race conditions between erasing the data files and writing new data. I'm working on getting more information.

ionelmc commented 2 years ago

pytest-cov does have a different way of setting up for multiprocessing (using register_after_fork and a finalizer) - maybe I could try to just copy whatever coverage has for subprocesses (reusing won't work since there's a different way coverage configuration is being set) but still, using fork mode is just asking for trouble...