coveragepy / coveragepy/coveragepy

Coverage XML report with sources argument turns root package name into period

Open
#613 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug xml
Dominant language
Python
Stars
3.4k
Forks
525
Avg merge
18h 27m
Merged PRs (30d)
6

Description

Originally reported by Nick Williams (Bitbucket: beamerblvd, GitHub: beamerblvd)


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.

Essentially, calling 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. :-)


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report through Coverage.xml_report with a sources argument, comparing it with the coverage xml command-line behavior. Review the pytest-cov issue linked in the report for the debugging details, then determine the expected top-level package name and verify the XML output after the behavior is corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.