[Django]-Code coverage with django debug server

3👍

Hmm, not sure what to make of that. When I create a brand new Django project, I get some coverage measurement:

$ django-admin.py startproject mysite
$ cd mysite
$ coverage run manage.py runserver
Validating models...

0 errors found
Django version 1.3, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
^C
$ coverage report
Name       Stmts   Miss  Cover
------------------------------
__init__       0      0   100%
manage        11      4    64%
settings      24      0   100%
------------------------------
TOTAL         35      4    89%

What OS, Django and coverage versions, etc? Anything else unusual in your project?

Measuring runserver alone may not be what you want, you may only measure the code that watches for file changes and relaunches the server. A Django test runner with coverage support may suit your needs better.

UPDATE:

Providing the –noreload switch makes coverage measure all your code.

Leave a comment