I am using a simple unit test based test runner to test my Django application.
My application itself is configured to use a basic logger in settings.py using:
<
I like Hassek's custom test runner idea. It should be noted that DjangoTestSuiteRunner
is no longer the default test runner in Django 1.6+, it has been replaced by the DiscoverRunner
. For default behaviour, the test runner should be more like:
import logging
from django.test.runner import DiscoverRunner
class NoLoggingTestRunner(DiscoverRunner):
def run_tests(self, test_labels, extra_tests=None, **kwargs):
# disable logging below CRITICAL while testing
logging.disable(logging.CRITICAL)
return super(NoLoggingTestRunner, self).run_tests(test_labels, extra_tests, **kwargs)