I am trying to run tests on django using coverage . It works fine, but does not define class definitions, as they are defined before starting to run. I have the following test runner that I use when calculating coverage:
import sys import os import logging from django.conf import settings MAIN_TEST_RUNNER = 'django.test.simple.run_tests' if settings.COMPUTE_COVERAGE: try: import coverage except ImportError: print "Warning: coverage module not found: test code coverage will not be computed" else: coverage.exclude('def __unicode__') coverage.exclude('if DEBUG') coverage.exclude('if settings.DEBUG') coverage.exclude('raise') coverage.erase() coverage.start() MAIN_TEST_RUNNER = 'django-test-coverage.runner.run_tests' def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
What can I do to make classes also covered? Otherwise, I have a fairly low coverage and I cannot easily find places that really need to be covered.
django testing code-coverage
gruszczy
source share