Skip to content

Allow [paths] normalization to run against a single report #1212

Closed
@eric-wieser

Description

@eric-wieser

When running coverage against an installed package, I have a config file like:

[paths]
source =
    src
    */site-packages

[run]
branch = true
source =
    tests
    my_package_name

and a working directory like:

src/my_package_name/
   foo.py
tests/
   test_foo.py
setup.py
.coveragerc

When I run coverage run -m pytest, I get coverage information from coverage report for filenames like

C:\Users\me\AppData\Local\Programs\Python\Python38\Lib\site-packages\my_package_name\foo.py
tests\test_foo.py

However, if I run

mv .coverage .coverage.hack  # I can't combine it without renaming
coverage combine
coverage report

Then I the output has the filenames I (and tools like codecov which match filenames against files in a git repo) want:

src\my_package_name\foo.py
tests\test_foo.py

Describe the solution you'd like
Either the PathAlias logic should be applied by default when producing a report, or there should be a command-line-flag / configuration option to make it behave this way

Additional context
Somewhat related to pytest-dev/pytest-cov#98

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions