summaryrefslogtreecommitdiff
path: root/django/test/utils.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-07-01 01:17:51 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-07-01 01:17:51 +0000
commit6f4e933fcc78da11ec43214efd3472192030eced (patch)
treed92140118d3afa00bcd909f475dd1a694c15c08f /django/test/utils.py
parent7a981380def046f753ff70a7c25efcd781ff6ac6 (diff)
newforms-admin: Merged to [5571]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5572 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/test/utils.py')
-rw-r--r--django/test/utils.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/django/test/utils.py b/django/test/utils.py
index f5122fa96d..4a858a6ec7 100644
--- a/django/test/utils.py
+++ b/django/test/utils.py
@@ -1,6 +1,7 @@
import sys, time
from django.conf import settings
-from django.db import connection, transaction, backend
+from django.db import connection, backend, get_creation_module
+from django.core import management, mail
from django.core import management, mail
from django.dispatch import dispatcher
from django.test import signals
@@ -88,6 +89,12 @@ def get_postgresql_create_suffix():
return ''
def create_test_db(verbosity=1, autoclobber=False):
+ # If the database backend wants to create the test DB itself, let it
+ creation_module = get_creation_module()
+ if hasattr(creation_module, "create_test_db"):
+ creation_module.create_test_db(settings, connection, backend, verbosity, autoclobber)
+ return
+
if verbosity >= 1:
print "Creating test database..."
# If we're using SQLite, it's more convenient to test against an
@@ -142,6 +149,12 @@ def create_test_db(verbosity=1, autoclobber=False):
cursor = connection.cursor()
def destroy_test_db(old_database_name, verbosity=1):
+ # If the database wants to drop the test DB itself, let it
+ creation_module = get_creation_module()
+ if hasattr(creation_module, "destroy_test_db"):
+ creation_module.destroy_test_db(settings, connection, backend, old_database_name, verbosity)
+ return
+
# Unless we're using SQLite, remove the test database to clean up after
# ourselves. Connect to the previous database (not the test database)
# to do so, because it's not allowed to delete a database while being