I filed this bug against
pytest-cov, but I believe there is also a bug in Coverage that was revealed in my debugging of this code.
I won't copy the lengthy details and IPDB debugging output into here that can be read there. I'll just post the Coverage-specific problem here.
coverage xml from the command line doesn't allow you to pass in
sources, so this problem doesn't reveal itself through normal usage. However, when you call
Coverage.xml_report from code (such as when integrating with
pytest-cov, etc.), you are allowed to supply
sources, and when doing so, the top-level package name in the XML report becomes a period (
.) instead of the actual package name. I'm not sure what the correct behavior is if
sources is passed in (or if that should be an error / not even an option in the XML reporter), but surely turning the top level package name into a period is not the correct behavior. :-)