Search code examples
python-3.xpytestcode-coveragecoverage.pynox

How do I access the coverage database generated by coverage.py and get a list of all executed statements?


The coverage report only shows the percentage, and I would like to know all executed statements.

Eventually, I need a map in which the key is the statement and the value is True(Executed)/False(Not Executed).

Is there any way to do this?


Solution

  • You can use the HTML report to see what statements are executed and not. You can access the data through the Coverage Data API: https://coverage.readthedocs.io/en/6.3.2/api_coveragedata.html

    What will you be doing with the executed/not-executed data?