<div dir="ltr">Run my_program() as a separate process?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 8, 2016 at 7:15 PM, Joel B. Mohler <span dir="ltr">&lt;<a href="mailto:joel@kiwistrawberry.us" target="_blank">joel@kiwistrawberry.us</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Python testers,<br>
<br>
I&#39;m trying to get a nice feedback loop for coverage testing both a Python REST<br>
server and the client side GUI program.  I thought I could get coverage to<br>
produce an html report on some interval -- say every 5-10 seconds.  This<br>
doesn&#39;t seem to be a documented use-case ... or is it?<br>
<br>
Following the documentation, I&#39;ve inserted:<br>
<br>
        import coverage<br>
        cov = coverage.Coverage()<br>
        cov.start()<br>
        sys.coverer = cov # stash this in a global place<br>
        my_program()  # bunch of code<br>
        cov.stop()<br>
        cov.save()<br>
        cov.html_report()<br>
<br>
Inside my_program (which is really a whole GUI event loop), I&#39;ve kicked off a<br>
little chunk periodically to update the html:<br>
<br>
        sys.coverer.save()<br>
        sys.coverer.html_report()<br>
        # attempt at hacking some result-caching by coverage<br>
        sys.coverer._measured = True<br>
<br>
On the first time I come to my update-the-html code and I get an htmlcov<br>
directory that looks correct.  On the second and subsequent times, it looks as<br>
though it rewrites exactly the same html.<br>
<br>
Is this possible?  Is there other caching I need to defeat?  There is file hash<br>
checking code in the HtmlReport which I do not fully understand.<br>
<br>
I understand this might be slow.  I was hoping that I could get an up-to-date<br>
CoverageData object quickly then go htmlify it in the background.  That looks<br>
difficult since the HtmlReport takes a Coverage object not a CoverageData.<br>
<br>
Thanks,<br>
Joel<br>
<br>
_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" rel="noreferrer" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
</blockquote></div><br></div>