Skip to content

Support coverage.py dynamic contexts when coverage is being collected #97

Open
@Julian

Description

@Julian

coverage.py supports a notion of "dynamic contexts".

The most common reason for these is answering "what tests cover a particular line" in the coverage output -- but right now that information doesn't descend into subtests, so you just see one single context reported when looking at output.

E.g. here's a screenshot from a project where I'm running like 200 subtests within a single test (called test_referencing_suite), only a few of which are going to really cover this line, even though it gets reported as "1 ctx":

Screenshot 2023-05-24 at 14 17 44

I think the way to do this is by including a coverage plugin which is aware of when/how subtests are entered (and to conditionally call into it if coverage is being collected) though I haven't looked closely to be honest, figured I'd file this and see if there's any appetite first for even including this here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions