Integrating coverage reports with Django
The django Web-Framework has some nice integration for testing. But how do you know if you test enough?
Siddharta Govindaraj has a blogpost on integrating Django with coverage.py to check what your tests actually test. Siddharta patches Django to archive his goals. But you can get the same results without fiddeling with Django’s Source-Code. Django now comes with a TEST_RUNNER setting which let’s you switch your testing engine.
tests_with_coverage.py is an example how to use this setting.
Now it seems I have to write some more tests:
lichtblick:~/code/dv2 md$ python manage.py test [...] Ran 81 tests in 11.828s FAILED (failures=1, errors=1) Name Stmts Exec Cover Missing ------------------------------------------------------------- produktpass.dataexchange 406 0 0% 6-727 produktpass.models 608 48 7% 3-72, [...] produktpass.models.constants 30 0 0% 3-393 produktpass.models.erp 33 0 0% 9-59 produktpass.models.managers 84 0 0% 3-117 produktpass.models.tools 102 12 11% 9-34, [...] produktpass.models.validators 130 36 27% 3-9, [...] produktpass.views 155 0 0% 5-230 produktpass.views.product 169 0 0% 9-203 ------------------------------------------------------------- TOTAL 1717 96 5% Destroying test database...
not working for development version
not working for development version
I only want to point out that this is not working for the development version of Django. You need to add the interactive keyword to the run_tests function. And i had to take the suite build process from django.test.simple.py to make run the tests.
This comment was originally posted on 20070813T10:23:07