When checking coverage using "coverage run" consider injecting a COVERAGE_<whatever> environment variable.
This would allow detecting that the code is being covered and proceed acroding to that information.
For example, to speed up tests I often just kill any subprocesses spawned instead of terminating them(yes we spawn a lot of processes and it does make a huge difference), however, this results in the coverage data not being written.
Should I provide a PR?
Maybe COVERAGE_COMMAND, which in this case would be set to run?