Skip to main content

A coverage.py plugin to measure the coverage of Django templates.

License Python versions supported Django versions supported Package stability
PyPI status Monthly PyPI downloads

Supported Python versions are 2.7 and 3.4. Supported Django versions are 1.4 through 1.8.

The plugin itself is pip installable:

$ pip install django_coverage_plugin

To run it, add this setting to your .coveragerc file:

[run]
plugins =
    django_coverage_plugin

Then run your tests under coverage.py. It requires coverage.py 4.0.

You will see your templates listed in your coverage report along with your Python modules.

If you get a django.core.exceptions.ImproperlyConfigured error, you need to set the DJANGO_SETTINGS_MODULE environment variable.

Configuration

The Django template plugin uses some existing settings from your .coveragerc file. The source=, include=, and omit= options control what template files are included in the report.

Caveats

Files included by the {% ssi %} tag are not included in the coverage measurements.

Coverage.py can’t tell whether a {% blocktrans %} tag used the singular or plural text, so both are marked as used if the tag is used.

Changes

v1.1, 12 November 2015

Explicitly configure settings if need be to get things to work.

v1.0: 20 September 2015

First version :)

What the? How?

The technique used to measure the coverage is the same that Dmitry Trofimov used in dtcov, but integrated into coverage.py as a plugin, and made more performant. I’d love to see how well it works in a real production project. If you want to help me with it, feel free to drop me an email.

The coverage.py plugin mechanism is designed to be generally useful for hooking into the collection and reporting phases of coverage.py, specifically to support non-Python files. If you have non-Python files you’d like to support in coverage.py, let’s talk.

Tests

To run the tests:

$ pip install -r requirements.txt
$ tox

Metadata

Release files for django-coverage-plugin 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-coverage-plugin 1.1
File Size Uploaded
django_coverage_plugin-1.1.tar.gz 5.4 kB Details

Release files / django_coverage_plugin-1.1.tar.gz

Download URL django_coverage_plugin-1.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dbe987cc7b08bfd5771a137f15bac59c7adc4fb0954139d0633cf058e27d607b
BLAKE2b-256 checksum
How to use checksums
3888961994748ce06ae8849d64fabbc778ffae24afc9ae1c1857cc21885df653
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

3.2.2

2 release files

3.2.0

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

1 release file

2.0.0

1 release file

1.8.0

1 release file

1.7.0

1 release file

1.6.0

1 release file

1.5.0

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4

1 release file

1.3.1

1 release file

1.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2

1 release file

This release

1.1 This release

1 release file

1.0

1 release file

1.0b1

0.6

1 release file

0.5

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page