[TIP] coverage.py vs QGIS
skip.montanaro at gmail.com
Tue Apr 14 12:01:29 PDT 2020
(First and foremost, I think you need to explain more about what you've
tried so far. Beyond that, as I've just gone through issues using
coverage.py in a multi-process setting, let me refer you to my recent
message and the thread it spawned:
It seems you have a somewhat more complicated setup than I did, but I will
point you to this section of the docs:
I advise you to read it carefully. I missed some things in my first
go-round, in particular this:
Measuring coverage in sub-processes is a little tricky. When you spawn a
sub-process, you are invoking Python to run your program. Usually, to get
coverage measurement, you have to use coverage.py to run your program. Your
sub-process *won’t be using coverage.py*, so we have to convince Python to
use coverage.py even when not explicitly invoked.
The documentation section on command line execution:
has this to say about complex multi-threaded/process/event situations:
Coverage.py can measure multi-threaded programs by default. If you are
using more exotic concurrency, with the multiprocessing, greenlet,
eventlet, or gevent libraries, then coverage.py will get very confused. Use
the --concurrency switch to properly measure programs using these
libraries. Give it a value of multiprocessing, thread, greenlet, eventlet,
or gevent. Values other than thread require the C extension.
I imagine it might be impossible to achieve perfection, but perhaps with
overlapping runs using different values for the --concurrency flag you
might get acceptable output.
On Tue, Apr 14, 2020 at 8:11 AM Sebastian M. Ernst <ernst at pleiszenburg.de>
> Hi all,
> I am trying to use `coverage.py` inside QGIS (1, 2). QGIS is a large
> hybrid C++/Python Qt-based application.
> Long story short: I am running into what appear to be nondeterministic
> race conditions plus a bunch of other issues. After reading the manual,
> I am guessing that with respect to QGIS' threads and Qt's event loops
> coverage.py is not meant to be used in this context ;)
> Question: Does anybody around here have any experience at all with
> coverage.py and QGIS or just coverage.py inside larger
> (C++/Qt/PyQt/hybrid) applications?
> Best regards,
> 1: https://www.qgis.org
> 2: https://github.com/qgis/QGIS
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python