nedbat / django_coverage_plugin

A plugin for coverage.py to measure Django template execution
Apache License 2.0
197 stars 35 forks source link

Included templates only discovered if they are in the same directory #11

Closed jessamynsmith closed 9 years ago

jessamynsmith commented 9 years ago

I have a project layout with a top-level templates directory containing base.html, and within apps I have template directories containing templates which extend the global base.html. When I run the plugin, base.html is not included in coverage. If I move base.html into the app template directory, it is included. As an example (where base.html is not included): https://github.com/jessamynsmith/eggtimer If I move eggtimer/templates/base.html into eggtimer/periods/templates/base.html, then it shows up in coverage.

nedbat commented 9 years ago

This was due the .coveragerc file having a setting of "source = api, eggtimer, periods", but the template was in "templates/base.html", so it was excluded by the source rule. Adding "templates" to the source option fixed it.