Skip to main content

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

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

The plugin itself is pip installable:

$ pip install django_coverage_plugin

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

[run]
plugins =
    django_coverage_plugin

Then run your tests under coverage.py. It requires the latest coverage.py, so it may not work with other coverage-related tools such as test-runner coverage plugins, or coveralls.io.

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

If you get a django.core.exceptions.ImproperlyConfigured error, you need to set the DJANGO_SETTINGS_MODULE environment variable. You may also have problems with importing the settings module with coverage commands. You can set PYTHONPATH=. to fix that. I’m interested in ideas about how to fix this better.

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. I’ve also got a plugin for Mako templates, but it needs some fixes from Mako. 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_coverage_plugin-0.3.3.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file django_coverage_plugin-0.3.3.tar.gz.

File metadata

File hashes

Hashes for django_coverage_plugin-0.3.3.tar.gz
Algorithm Hash digest
SHA256 430ccdb44ec3ea7b737103500107cd2d36be05cadbb0bd035304c03b4f62beb9
MD5 30e9e3a53cc6a6b36226b74e10d6d966
BLAKE2b-256 3cd4ae7ec9c28b99875f8984893ca691d3a0e92c4d0935d0fc700502b0795a77

See more details on using hashes here.

Release history Release notifications | RSS feed

3.2.2

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

3.0.0

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

1 file

2.0.0

1 file

1.8.0

1 file

1.7.0

1 file

1.6.0

1 file

1.5.0

1 file

1.4.2

1 file

1.4.1

1 file

1.4

1 file

1.3.1

1 file

1.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2

1 file

1.1

1 file

1.0

1 file

1.0b1

0.6

1 file

0.5

1 file

This release

0.3.3 This release

1 file

0.3.2

1 file

0.3.1

1 file

0.3

1 file

0.1

1 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