I am looking at an html coverage report generated by pytest-cov and I wonder if I can find which tests have invoked a particular line (which test covered a particular line).
CodePudding user response:
Coverage.py includes a feature called "contexts" which can easily be used to annotate results with test names: https://coverage.readthedocs.io/en/latest/contexts.html
Put this in your .coveragerc file:
[run]
dynamic_context = test_function