skillfed

django-coverage-plugin

Django template coverage.py plugin

django-coverage-plugin v3.2.2 1.1M downloads/30d#4,430 on PyPI203
Permissive license Apache-2.0 Active released

What it is and what it does

django-coverage-plugin extends coverage.py to track which lines of your Django HTML templates are executed during testing. Rather than treating templates as unmeasured code, it hooks into Django's template debugging system to record which template lines ran, which didn't, and which were conditionally skipped. You configure it by adding a single line to your .coveragerc file, then run your tests normally under coverage.py—templates appear in your coverage report just like Python modules.

The plugin requires Django templates to have debugging enabled (TEMPLATES.OPTIONS.debug = True) and works with Django 5.2 through 6.0 on Python 3.10 through 3.14. It can also discover unused template files in your templates directory and include them in results. Configuration supports filtering by file extension and respects standard coverage.py settings like source, include, and omit.

Use it for:

  • Measure test coverage of Django template rendering to identify untested template branches and conditional blocks
  • Discover unused template files in your project that can be safely removed
  • Enforce minimum coverage thresholds for templates as part of CI/CD pipelines
  • Debug template execution paths by seeing which lines ran during specific test cases
  • Generate unified coverage reports combining Python and template coverage metrics

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A coverage.py plugin that measures test coverage of Django templates, integrating template execution tracking into your coverage reports alongside Python code coverage.

Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real gap in Django testing—template coverage is otherwise invisible to standard coverage.py. Install it if you use Django templates and want to measure test coverage comprehensively. The only gotcha is the requirement to enable template debugging in settings, which is documented clearly.

Install

django-coverage-plugin on PyPI

pip

pip install django-coverage-plugin

uv

uv add django-coverage-plugin

poetry

poetry add django-coverage-plugin

Installing django-coverage-plugin

Before you install

Low install friction with a wheel distribution. Actively maintained as of 2026-04-04, with recent fixes for template line reporting and support for Django 5.2 and 6.0. Requires only coverage and Django as runtime dependencies.

License in practice

Licensed under Apache-2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions beyond attribution.

Quickstart

pip install django-coverage-plugin

# Add to .coveragerc:
# [run]
# plugins = django_coverage_plugin

# Then run:
coverage run --source='.' manage.py test
coverage report

DJANGO_SETTINGS_MODULE environment variable must be set, and TEMPLATES.OPTIONS.debug must be True in your Django settings for template coverage to work.

Verify before relying

  • Whether template coverage accuracy varies significantly across different Django template tag libraries or custom tags
  • Performance impact on large projects with hundreds or thousands of templates

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — coverage, Django
Maintenance actively maintained — 132 days since the last release
Last repo commit
First released
Downloads 1,057,576/month — #4,430 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_coverage_plugin-3.2.2-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: ConsoleFramework :: DjangoFramework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: Testing

Tags

django template coverage measurementcoverage.py django plugintemplate test coverage reportingdjango template debugging coveragecoverage integration django templates
django-testingcoverage-measurement

More Testing packages