Skip to content

Config option or Plugin hook to remap paths in output #2127

@mastacheata

Description

@mastacheata

Is your feature request related to a problem? Please describe.
When running coverage in a system that's different from the one where we look at the reports our IDE (PyCharm) can't map the reported coverage to the local paths.
For example: I run the coverage inside a docker container where the base path is /app/, then want to look at the report in my local IDE where the same files are actually living in /home/mastacheata/project/
The coverage reports all claim /app/ as their base directory with no way of changing that from within coverage itself.

Describe the solution you'd like
Ideally I'd love if we could configure path mappings reverse to what is currently possible - if the report has /app/example.py I would like that to be translated to /home/mastacheata/project/example.py and so on.
If this can't included in the config options, maybe a general interface for a plugin to merely intercept and format it's own output without having to reimplement/call the original tracing and reporting steps the current plugin system offers would be a feasible alternative.
Basically I want something that relies mainly on configuration and not on having to run a shell-script / custom wrapper around coverage so it works all the time out of the box.

Describe alternatives you've considered
Solutions right now are always involving external tooling that is not automatically called, like wrapping the coverage command in a script to process the output or simply calling something like sed after the coverage report is done.

Additional context
I've tried my luck requesting JetBrains to add support for path mappings to their coverage visualizer built into the IDE, but that issue is sitting there untouched for 3+ years already - I don't think they will even consider that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions