[TIP] Problem collecting coverage for D-Bus activated subprocesses

Barry Warsaw barry at python.org
Sun Aug 10 09:17:54 PDT 2014


On Aug 09, 2014, at 11:01 AM, Ned Batchelder wrote:

>The nose plugins are frankly a bane of my existence, because they are very
>opinionated, and I don't use them so I often overlook the possibility of
>their effects.  I prefer to control coverage directly.

Yep, and now I do too!  I really like nose2, but after looking more closely, I
don't think the nose2_cov plugin is adding much value to my project, so I'm
just going to drop it.

>It is a quirk of the CPython trace function that it only takes effect when a
>function is called.  So you call coverage.start(), then it isn't until the
>next function call in your code that the tracing will begin.

Ah interesting - I think I knew that once. ;)

In any case, a couple of things now make my numbers much better (other than
the weird un-omit-able paths).

* My tox.ini calls `coverage run`[1] directly so there's no need to enable it
  in the main process, and everything in that main process gets properly
  covered.

* I created a mini dummy/testing D-Bus main().  All it does is enable coverage
  and then call the real D-Bus main().  Because this lives in a test
  infrastructure test subpackage I'm filtering out, the real D-Bus main now
  gets fully covered.

Coverage is really awesome goodness.  I've already identified a few legitimate
missing tests, although I have a bit more work to evaluate and maybe add some
more pragma labels or tests.

Cheers,
-Barry

[1] Using the quirky Debian invocation to get the right tox-environment
$python to run the system's Python 3 compatible coverage script.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20140810/23c5b8f3/attachment.pgp>


More information about the testing-in-python mailing list