Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored August 20, 2007
19  django/db/backends/oracle/creation.py
@@ -36,9 +36,7 @@
36 36
 PASSWORD = 'Im_a_lumberjack'
37 37
 REMEMBER = {}
38 38
 
39  
-
40  
-def create_test_db(settings, connection, backend, verbosity=1, autoclobber=False):
41  
-
  39
+def create_test_db(settings, connection, verbosity=1, autoclobber=False):
42 40
     TEST_DATABASE_NAME = _test_database_name(settings)
43 41
     TEST_DATABASE_USER = _test_database_user(settings)
44 42
     TEST_DATABASE_PASSWD = _test_database_passwd(settings)
@@ -115,8 +113,7 @@ def create_test_db(settings, connection, backend, verbosity=1, autoclobber=False
115 113
     # the side effect of initializing the test database.
116 114
     cursor = connection.cursor()
117 115
 
118  
-
119  
-def destroy_test_db(settings, connection, backend, old_database_name, verbosity=1):
  116
+def destroy_test_db(settings, connection, old_database_name, verbosity=1):
120 117
     connection.close()
121 118
 
122 119
     TEST_DATABASE_NAME = _test_database_name(settings)
@@ -152,7 +149,6 @@ def destroy_test_db(settings, connection, backend, old_database_name, verbosity=
152 149
         _destroy_test_db(cursor, parameters, verbosity)
153 150
     connection.close()
154 151
 
155  
-
156 152
 def _create_test_db(cursor, parameters, verbosity):
157 153
     if verbosity >= 2:
158 154
         print "_create_test_db(): dbname = %s" % parameters['dbname']
@@ -168,7 +164,6 @@ def _create_test_db(cursor, parameters, verbosity):
168 164
     ]
169 165
     _execute_statements(cursor, statements, parameters, verbosity)
170 166
 
171  
-
172 167
 def _create_test_user(cursor, parameters, verbosity):
173 168
     if verbosity >= 2:
174 169
         print "_create_test_user(): username = %s" % parameters['user']
@@ -182,7 +177,6 @@ def _create_test_user(cursor, parameters, verbosity):
182 177
     ]
183 178
     _execute_statements(cursor, statements, parameters, verbosity)
184 179
 
185  
-
186 180
 def _destroy_test_db(cursor, parameters, verbosity):
187 181
     if verbosity >= 2:
188 182
         print "_destroy_test_db(): dbname=%s" % parameters['dbname']
@@ -192,7 +186,6 @@ def _destroy_test_db(cursor, parameters, verbosity):
192 186
         ]
193 187
     _execute_statements(cursor, statements, parameters, verbosity)
194 188
 
195  
-
196 189
 def _destroy_test_user(cursor, parameters, verbosity):
197 190
     if verbosity >= 2:
198 191
         print "_destroy_test_user(): user=%s" % parameters['user']
@@ -202,7 +195,6 @@ def _destroy_test_user(cursor, parameters, verbosity):
202 195
     ]
203 196
     _execute_statements(cursor, statements, parameters, verbosity)
204 197
 
205  
-
206 198
 def _execute_statements(cursor, statements, parameters, verbosity):
207 199
     for template in statements:
208 200
         stmt = template % parameters
@@ -214,7 +206,6 @@ def _execute_statements(cursor, statements, parameters, verbosity):
214 206
             sys.stderr.write("Failed (%s)\n" % (err))
215 207
             raise
216 208
 
217  
-
218 209
 def _test_database_name(settings):
219 210
     name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME
220 211
     try:
@@ -226,7 +217,6 @@ def _test_database_name(settings):
226 217
         raise
227 218
     return name
228 219
 
229  
-
230 220
 def _test_database_create(settings):
231 221
     name = True
232 222
     try:
@@ -240,7 +230,6 @@ def _test_database_create(settings):
240 230
         raise
241 231
     return name
242 232
 
243  
-
244 233
 def _test_user_create(settings):
245 234
     name = True
246 235
     try:
@@ -254,7 +243,6 @@ def _test_user_create(settings):
254 243
         raise
255 244
     return name
256 245
 
257  
-
258 246
 def _test_database_user(settings):
259 247
     name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME
260 248
     try:
@@ -266,7 +254,6 @@ def _test_database_user(settings):
266 254
         raise
267 255
     return name
268 256
 
269  
-
270 257
 def _test_database_passwd(settings):
271 258
     name = PASSWORD
272 259
     try:
@@ -278,7 +265,6 @@ def _test_database_passwd(settings):
278 265
         raise
279 266
     return name
280 267
 
281  
-
282 268
 def _test_database_tblspace(settings):
283 269
     name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME
284 270
     try:
@@ -290,7 +276,6 @@ def _test_database_tblspace(settings):
290 276
         raise
291 277
     return name
292 278
 
293  
-
294 279
 def _test_database_tblspace_tmp(settings):
295 280
     name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME + '_temp'
296 281
     try:
6  django/test/utils.py
... ...
@@ -1,6 +1,6 @@
1 1
 import sys, time
2 2
 from django.conf import settings
3  
-from django.db import connection, backend, get_creation_module
  3
+from django.db import connection, get_creation_module
4 4
 from django.core import mail
5 5
 from django.core.management import call_command
6 6
 from django.dispatch import dispatcher
@@ -97,7 +97,7 @@ def create_test_db(verbosity=1, autoclobber=False):
97 97
     # If the database backend wants to create the test DB itself, let it
98 98
     creation_module = get_creation_module()
99 99
     if hasattr(creation_module, "create_test_db"):
100  
-        creation_module.create_test_db(settings, connection, backend, verbosity, autoclobber)
  100
+        creation_module.create_test_db(settings, connection, verbosity, autoclobber)
101 101
         return
102 102
 
103 103
     if verbosity >= 1:
@@ -165,7 +165,7 @@ def destroy_test_db(old_database_name, verbosity=1):
165 165
     # If the database wants to drop the test DB itself, let it
166 166
     creation_module = get_creation_module()
167 167
     if hasattr(creation_module, "destroy_test_db"):
168  
-        creation_module.destroy_test_db(settings, connection, backend, old_database_name, verbosity)
  168
+        creation_module.destroy_test_db(settings, connection, old_database_name, verbosity)
169 169
         return
170 170
 
171 171
     # Unless we're using SQLite, remove the test database to clean up after

0 notes on commit b3912d3

Please sign in to comment.
Something went wrong with that request. Please try again.