diff --git a/django_statsd/patches/__init__.py b/django_statsd/patches/__init__.py index 9bfa630..f6df76b 100644 --- a/django_statsd/patches/__init__.py +++ b/django_statsd/patches/__init__.py @@ -1,27 +1,7 @@ from django.conf import settings from django.utils.importlib import import_module -# Workaround for tests. -try: - minimal = { - 'DATABASES': { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': 'mydatabase' - } - }, - 'ROOT_URLCONF': '', - 'STATSD_CLIENT': 'django_statsd.clients.null', - 'STATSD_PREFIX': None, - 'METLOG': None - } - - if not settings.configured: - settings.configure(**minimal) - - patches = getattr(settings, 'STATSD_PATCHES', []) -except ImportError: - patches = [] +patches = getattr(settings, 'STATSD_PATCHES', []) for patch in patches: import_module(patch).patch() diff --git a/django_statsd/test_settings.py b/django_statsd/test_settings.py new file mode 100644 index 0000000..2293410 --- /dev/null +++ b/django_statsd/test_settings.py @@ -0,0 +1,13 @@ +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'mydatabase' + } +} + +ROOT_URLCONF = '' +STATSD_CLIENT = 'django_statsd.clients.null' +STATSD_PREFIX = None, +METLOG = None + +SECRET_KEY = 'secret' diff --git a/docs/index.rst b/docs/index.rst index d8ae084..05172f9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -308,6 +308,13 @@ do this by adding in the handler. For example in your logging configuration:: }, } +Testing +======= + +You can run tests with the following command: + + DJANGO_SETTINGS_MODULE='django_statsd.test_settings' nosetests + Nose ====