<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">QGIS is a C++/Qt5 app at the moment. At some point in the past, Python<br>
scripting capability, a Python console inside the app and a Python<br>
plugin system were added, see (1). The QGIS-API-to-Python bridge is<br>
based on SIP (2). Python itself is linked into the app through<br>
`libpython`, see (3). Therefore there is no Python command that I can<br>
substitute with coverage.<br></blockquote><div><br></div><div class="gmail_default" style="font-family:arial,sans-serif">I would try creating a .coveragerc file and running your program with COVERAGE_PROCESS_START set to refer to it. See if that provokes some meaningful output.</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">```python<br>
import os<br>
import atexit<br>
from coverage import Coverage<br>
_cov = Coverage(source = os.path.dirname(__file__))<br>
_cov.start()<br>
atexit.register(_cov.stop)<br>
```<br>
<br>
The use of `atexit` did not work at all, <span class="gmail_default" style="font-family:arial,sans-serif">...</span></blockquote><div><br></div><div class="gmail_default" style="font-family:arial,sans-serif">As in didn&#39;t produce a call to _cov.stop? I don&#39;t see any mention of running coverage.py when Python is embedded, but I do see an open issue about it. What if you try something more basic. Skip the coverage stuff altogether, but register a visible exit handler:</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">atexit.register(print, &quot;goodbye world&quot;)</div><div class="gmail_default" style="font-family:arial,sans-serif"></div><div class="gmail_default" style="font-family:arial,sans-serif">If that doesn&#39;t work, maybe someone else has an idea how to provoke coverage output at intervals during the run. Perhaps you could schedule calls to _cov.save at intervals during the run from a plugin.</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">Skip</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div></div></div>