Description
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":

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.