nedbat / django_coverage_plugin

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

Fix #20 -- Allow multiple DTL engines. #21

Closed charettes closed 8 years ago

charettes commented 8 years ago

Multiple engines should be supported as long as they all use DTL.

charettes commented 8 years ago

Is this missing anything to be merged?

nedbat commented 8 years ago

Sorry, my attention has mostly been elsewhere recently.
I don't have personal experience with multiple template engines. Right now, the code will refuse to work if you have two Django template backends, and one of them is not debug-enabled. Is that reasonable? Can we add some tests for the multiple-engine case?

charettes commented 8 years ago

Sorry, my attention has mostly been elsewhere recently.

No worries!

I don't have personal experience with multiple template engines.

They are useful if you want to define different set of built-ins and/or context processors for specific use cases. For example, in a specific project I use the default engine as usual and define a restricted aliased engine to allow the rendering of some user provided templates.

Right now, the code will refuse to work if you have two Django template backends, and one of them is not debug-enabled.

Unsure how we should handle this case. IMHO we shouldn't crash if template debugging is turned off even if only one engine is configured. I think raising a RuntimeWarning (using warnings.warn) for each configured backend would be more appropriate but this is something that can be done in another commit/PR. Thoughts?

Can we add some tests for the multiple-engine case?

I'll add them right now.

charettes commented 8 years ago

Added test for multiple template engines.

nedbat commented 8 years ago

Thanks, this is version 1.3! :)

nedbat commented 8 years ago

(btw, I made some adjustments to the tests)

charettes commented 8 years ago

Thanks Ned!