Incremental code coverage for Python unit tests?

Brief

I use pycobertura.

pycobertura diff --format html --output cov_diff.html coverage_old.xml coverage_new.xml


Details

I use the following chain (coverage):

  1. Generate coverage report: python -m coverage run -m unittest

  2. Output cobertura's XML format: coverage xml --omit tests/* -o cover_old.xml

  3. -- Modify code or checkout newer commit --

  4. Generate coverage report: python -m coverage run -m unittest

  5. Output cobertura's XML format: coverage xml --omit tests/* -o cover_new.xml

  6. Generate diff: pycobertura diff --format html --output cov_diff.html coverage_old.xml coverage_new.xml