html report and package name vs (module) file (absolute) path : question

Issue #520 closed
Gregory Starck created an issue


I have this situation / structure:

    my_pkg/  # obviously

(actually my_pkg is deeper below my_project, under a kind of "src" directory but this doesn't change anything)

I'm trying to get coverage to output / generate html with "package names" for my_pkg ; that is I'm trying to get:

Name                                     Stmts   Miss  Cove
my_pkg   :      1234 234     30% 
my_pkg.a    :   etc xx% lines 
my_pkg.a.b   :   etc 
# etc.. 

but if I normally pip install my package, then what I get is:

Name                                     Stmts   Miss  Cove
/abs_path_to_python_site_package/my_pkg/  :   1234 234  30%

that is : how to get the package/module name instead of (absolute) file paths in the html report, as I ?

at the best I can eventually get relative paths to the files in case I test "in place" but isn't it possible to get the package/module (dotted) names instead ?

I searched the docs, stackoverflow, googled anything I could but I don't find.


Comments (2)

  1. Loic Dachary

    I don't think there is a way to get dotted package names instead of a path. It would be tricky because. my_pkg/ would have to be my_pkg. But when reading my_pkg in the results, it's unclear if that is or my_pkg/ And it's non trivial to figure out in which directory of PYTHONPATH it is located. I can't figure out a way to display that so it looks pretty and non confusing. Any ideas ?

  2. Log in to comment