diff options
| author | Anssi Kääriäinen | 2012-08-27 15:05:05 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen | 2012-08-27 15:30:57 +0300 |
| commit | 18bd5da161716eea743fcce1e9f82f0e79f1505c (patch) | |
| tree | 2cf40976b4af69d858f60c18afa03ebd3c651bb1 | |
| parent | c1f7b3a273600b94dc433902c0a480dc8874d26a (diff) | |
| download | django-debug-toolbar-18bd5da161716eea743fcce1e9f82f0e79f1505c.tar.bz2 | |
Made possible to use DJANGO_SETTINGS_MODULE in testing
Also added a dummy test_pgsql settings file.
| -rw-r--r-- | runtests.py | 5 | ||||
| -rw-r--r-- | test_pgsql.py | 28 |
2 files changed, 32 insertions, 1 deletions
diff --git a/runtests.py b/runtests.py index 3432f8b..ed49824 100644 --- a/runtests.py +++ b/runtests.py @@ -1,11 +1,14 @@ #!/usr/bin/env python import sys +import os from os.path import dirname, abspath from optparse import OptionParser from django.conf import settings, global_settings -if not settings.configured: +# For convenience configure settings if they are not pre-configured or if we +# haven't been provided settings to use by environment variable. +if not settings.configured and not os.environ.get('DJANGO_SETTINGS_MODULE'): settings.configure( DATABASES={ 'default': { diff --git a/test_pgsql.py b/test_pgsql.py new file mode 100644 index 0000000..28c0178 --- /dev/null +++ b/test_pgsql.py @@ -0,0 +1,28 @@ +from django.conf import global_settings +DATABASES={ + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + # Edit the below settings before use... + 'USER': '', + 'NAME': '', + 'HOST': '', + 'PASSWORD': '', + } +} +INSTALLED_APPS=[ + 'django.contrib.auth', + 'django.contrib.admin', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + + 'debug_toolbar', + + 'tests', +] +MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + ( + 'debug_toolbar.middleware.DebugToolbarMiddleware', +) +ROOT_URLCONF='' +DEBUG=False +SITE_ID=1 |
