I have a coverage report that may be lying or distorted. It says that I have coverage for a line in my Django model code. I can't see where that line is being exercised. I can see that the module is imported, that the class is imported, but not that it's being invoked/instantiated.
Thus, coverage report says I have Line A covered. Presumably that means Line B, somewhere, is exercising it. I'd like to know where Line B is. Is there a way to find the set of Line-B's (one or more) that are calling Line A, in my tests?
It seems this could be an annotation in the coverage report somehow/somewhere. It's definitely knowable, since coverage has to keep track of a thing being used.
I'm not seeing it.
If this isn't implemented, I'd like to suggest it. I know, it may be too complex as a full stack trace for each line of execution. But, maybe just the inspect of the immediate calling frame would be a good start, and helpful.
import traceback; traceback.print_stack()
before the line in question and run tests with the-s
arg. – hoefling