[TIP] coverage.py and appengine

Ivo Bellin Salarin ivo.bellinsalarin at gmail.com
Tue Feb 7 06:32:16 PST 2017

Hi everybody,

has someone on this list been using coverage.py to collect code coverage on
appengine applications, recently?

I have been successful in collecting it, in an intrusive manner, hacking
sandbox.py and stubs.py (because, in such environment, an application
hasn't the right to write to the disk). Intrusive also means "modifying the
code of the running application in order to call CodeCoverage API". My
modifications occasionally generate concurrency errors (because of a
failing assert in Collector.stop(), lines 306 and 307). These are the
reasons for which I am not satisfied about this way of collecting CC.

I have also tried to collect the code coverage in a non intrusive way
(read: setting the COVERAGE_PROCESS_START environment variable and
preparing an ad-hoc pth file that gets loaded during python processes
startup). But in this case I collect *nothing* (apart from 5 statements out
of 6 in /etc/python/sitecustomize.py). Perhaps because each appengine
request is being processed in a particular environment where environment
variables have a special meaning (and as such, the calling process
environment variables have vanished).

So, before abandoning the quest, I am searching for ideas or previously
successful experiences.

Just in case, I try to get CC on Ubuntu 16.04 and MacOS, using python 2.7
(a standard appengine environment).

Many thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20170207/e709eeb2/attachment.html>

More information about the testing-in-python mailing list