Created
October 28, 2010 20:27
-
-
Save jacobian/652261 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a test settings file suitable for running Django's under a build slave. | |
Out of the box it's configured to run tests against SQLite, but there are | |
examples below, commented out, to run tests against MySQL and PostgreSQL. | |
The important parts: | |
* You must have two databases: "default" and "other". | |
* For all databases except SQLite, the "default" database must exist and you | |
must be able to connect to it given the creds in the settings. | |
* Again, for "real" databases the given user must have privileges sufficient | |
to create a new database. | |
* That database will be called the value of TEST_NAME. The PID is included | |
in this name because you might want to run multiple tests simultaneously. | |
""" | |
import os | |
### | |
### SQLite config | |
### | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3' | |
}, | |
'other': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'TEST_NAME': 'other_db_%s' % os.getpid(), | |
} | |
} | |
### | |
### PostgreSQL config | |
### | |
# DATABASES = { | |
# 'default': { | |
# 'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
# 'NAME': 'django_tests', | |
# 'HOST': 'localhost', | |
# 'USER': 'django_tests', | |
# 'PASSWORD': 'django_tests', | |
# 'TEST_NAME': 'django_tests_%s' % os.getpid(), | |
# }, | |
# 'other': { | |
# 'ENGINE': 'django.db.backends.sqlite3', | |
# 'TEST_NAME': 'other_db_%s' % os.getpid(), | |
# } | |
# } | |
### | |
### MySQL config | |
### | |
# DATABASES = { | |
# 'default': { | |
# 'ENGINE': 'django.db.backends.mysql', | |
# 'NAME': 'django_tests', | |
# 'HOST': 'localhost', | |
# 'USER': 'django_tests', | |
# 'PASSWORD': 'django_tests', | |
# 'TEST_NAME': 'django_tests_%s' % os.getpid(), | |
# }, | |
# 'other': { | |
# 'ENGINE': 'django.db.backends.sqlite3', | |
# 'TEST_NAME': 'other_db_%s' % os.getpid(), | |
# } | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment