Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed backend create_test_db() and destroy_test_db() hooks NOT to t…

…ake the backend as an argument, as the backend as an object is going away

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b3912d360991f0e34beb9f584a21c0c532f822ac 1 parent f0decc1
Adrian Holovaty adrianholovaty authored
Showing with 5 additions and 20 deletions.
  1. +2 −17 django/db/backends/oracle/creation.py
  2. +3 −3 django/test/utils.py
19 django/db/backends/oracle/creation.py
View
@@ -36,9 +36,7 @@
PASSWORD = 'Im_a_lumberjack'
REMEMBER = {}
-
-def create_test_db(settings, connection, backend, verbosity=1, autoclobber=False):
-
+def create_test_db(settings, connection, verbosity=1, autoclobber=False):
TEST_DATABASE_NAME = _test_database_name(settings)
TEST_DATABASE_USER = _test_database_user(settings)
TEST_DATABASE_PASSWD = _test_database_passwd(settings)
@@ -115,8 +113,7 @@ def create_test_db(settings, connection, backend, verbosity=1, autoclobber=False
# the side effect of initializing the test database.
cursor = connection.cursor()
-
-def destroy_test_db(settings, connection, backend, old_database_name, verbosity=1):
+def destroy_test_db(settings, connection, old_database_name, verbosity=1):
connection.close()
TEST_DATABASE_NAME = _test_database_name(settings)
@@ -152,7 +149,6 @@ def destroy_test_db(settings, connection, backend, old_database_name, verbosity=
_destroy_test_db(cursor, parameters, verbosity)
connection.close()
-
def _create_test_db(cursor, parameters, verbosity):
if verbosity >= 2:
print "_create_test_db(): dbname = %s" % parameters['dbname']
@@ -168,7 +164,6 @@ def _create_test_db(cursor, parameters, verbosity):
]
_execute_statements(cursor, statements, parameters, verbosity)
-
def _create_test_user(cursor, parameters, verbosity):
if verbosity >= 2:
print "_create_test_user(): username = %s" % parameters['user']
@@ -182,7 +177,6 @@ def _create_test_user(cursor, parameters, verbosity):
]
_execute_statements(cursor, statements, parameters, verbosity)
-
def _destroy_test_db(cursor, parameters, verbosity):
if verbosity >= 2:
print "_destroy_test_db(): dbname=%s" % parameters['dbname']
@@ -192,7 +186,6 @@ def _destroy_test_db(cursor, parameters, verbosity):
]
_execute_statements(cursor, statements, parameters, verbosity)
-
def _destroy_test_user(cursor, parameters, verbosity):
if verbosity >= 2:
print "_destroy_test_user(): user=%s" % parameters['user']
@@ -202,7 +195,6 @@ def _destroy_test_user(cursor, parameters, verbosity):
]
_execute_statements(cursor, statements, parameters, verbosity)
-
def _execute_statements(cursor, statements, parameters, verbosity):
for template in statements:
stmt = template % parameters
@@ -214,7 +206,6 @@ def _execute_statements(cursor, statements, parameters, verbosity):
sys.stderr.write("Failed (%s)\n" % (err))
raise
-
def _test_database_name(settings):
name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME
try:
@@ -226,7 +217,6 @@ def _test_database_name(settings):
raise
return name
-
def _test_database_create(settings):
name = True
try:
@@ -240,7 +230,6 @@ def _test_database_create(settings):
raise
return name
-
def _test_user_create(settings):
name = True
try:
@@ -254,7 +243,6 @@ def _test_user_create(settings):
raise
return name
-
def _test_database_user(settings):
name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME
try:
@@ -266,7 +254,6 @@ def _test_database_user(settings):
raise
return name
-
def _test_database_passwd(settings):
name = PASSWORD
try:
@@ -278,7 +265,6 @@ def _test_database_passwd(settings):
raise
return name
-
def _test_database_tblspace(settings):
name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME
try:
@@ -290,7 +276,6 @@ def _test_database_tblspace(settings):
raise
return name
-
def _test_database_tblspace_tmp(settings):
name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME + '_temp'
try:
6 django/test/utils.py
View
@@ -1,6 +1,6 @@
import sys, time
from django.conf import settings
-from django.db import connection, backend, get_creation_module
+from django.db import connection, get_creation_module
from django.core import mail
from django.core.management import call_command
from django.dispatch import dispatcher
@@ -97,7 +97,7 @@ 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)
+ creation_module.create_test_db(settings, connection, verbosity, autoclobber)
return
if verbosity >= 1:
@@ -165,7 +165,7 @@ 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)
+ creation_module.destroy_test_db(settings, connection, old_database_name, verbosity)
return
# Unless we're using SQLite, remove the test database to clean up after
Please sign in to comment.
Something went wrong with that request. Please try again.