Skip to content

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

Open
@nedbat

Description

@nedbat

Originally reported by Gregory Starck (Bitbucket: gstarck, GitHub: gstarck)


Hi,

I have this situation / structure:

my_project/
    setup.py
    my_pkg/
    my_pkg/__init__.py  # obviously
    my_pkg/a
    my_pkg/a/__init__.py
    my_pkg/a/b.py
    my_pkg/c.py
    etc...

(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/__init__.py  :   1234 234  30%
/abs_path_to_python_site_package/my_pkg/a.py

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.

thx.


Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions