1. Mikhail Korobov
  2. django-coverage
Issue #13 new

Branch coverage

Kenneth Knowles
created an issue

Hello,

I would love to have access to branch coverage.

I tried this by replacing

coverage.start()
...
coverage.end()

with

the_coverage = coverage.coverage(branch=True)
the_coverage.start()
...
the_coverage.end()

But I just got 0% coverage everywhere then. Presumably I need to do something else while instantiating, or maybe I had some other problem, but I figured you may be able to solve this very quickly and easily. I am not sure if this should be activated by adding an option to settings.py or by supporting .coveragerc completely (it seems to be ignored?)

  • Kenn

Comments (1)

  1. Adrián López Calvo

    Hello,

    I "almost" fixed this in my fork, but it breaks the custom html report. It's because it uses the old module API (see comment here) which doesn't support branch coverage.

    I'm trying to fix it prior to a pull request, but I don't understand ModuleVars and I'd need to replace the call to analysis2() done there.

    Any info on this Mikhail? How can I provide a coverage instance to ModuleVars? It seems some kind of singleton or cache and I don't want to mess it.

    EDIT:

    Ok, I think I got it. It doesn't crash now but branches aren't implemented in the custom html. I'm going to stop here since I'm not really interested in the custom export.

    Many thanks,

    Adrián

  2. Log in to comment