Skip to content

Unexpected data appears #2044

@WeiMengXS

Description

@WeiMengXS

Why does the coverage API report an unexpected number of lines? For instance, my source file has only 180 lines, yet the coverage tool indicates that 218 or 219 lines are covered.(The issue doesn't occur right after the program starts, but it surfaces after running for a while and is consistently reproducible.)

python version: 3.8
coverage version: 7.6.1

Use:

        cover_data = cover.get_data()
        for filename in cover_data.measured_files():
             file_reporter = cover._get_file_reporter(filename)
             covered_line_list = file_reporter.translate_lines(analysis.executed) or []

Unexpected data in covered_line_list!

Are there any similar solved cases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions