Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

magic-removal: Removed legacy init_minimal calls. Unit test framework…

… works again.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2387 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 65dc8f000baa35ec4518e5a6ff41a1b0d714561c 1 parent 39e4e8c
Adrian Holovaty authored February 25, 2006
19  django/core/management.py
@@ -297,15 +297,13 @@ def get_sql_initial_data(app):
297 297
     output = []
298 298
 
299 299
     app_models = get_models(app)
300  
-    app_label = app_models[0]._meta.app_label
301  
-    output.append(_get_packages_insert(app_label))
302 300
     app_dir = os.path.normpath(os.path.join(os.path.dirname(app.__file__), 'sql'))
303 301
 
304 302
     for klass in app_models:
305 303
         opts = klass._meta
306 304
 
307 305
         # Add custom SQL, if it's available.
308  
-        # FIXME: This probably needs changing
  306
+        # TODO: This probably needs changing
309 307
         sql_files = [os.path.join(app_dir, opts.module_name + '.' + settings.DATABASE_ENGINE +  '.sql'),
310 308
                      os.path.join(app_dir, opts.module_name + '.sql')]
311 309
         for sql_file in sql_files:
@@ -314,11 +312,14 @@ def get_sql_initial_data(app):
314 312
                 output.append(fp.read())
315 313
                 fp.close()
316 314
 
317  
-        # Content types.
318  
-        output.append(_get_contenttype_insert(opts))
319  
-        # Permissions.
320  
-        for codename, name in _get_all_permissions(opts):
321  
-            output.append(_get_permission_insert(name, codename, opts))
  315
+        # TODO: This is temporarily commented out until we come up
  316
+        # with a better way of letting people initialize content types and
  317
+        # permissions.
  318
+#         # Content types.
  319
+#         output.append(_get_contenttype_insert(opts))
  320
+#         # Permissions.
  321
+#         for codename, name in _get_all_permissions(opts):
  322
+#             output.append(_get_permission_insert(name, codename, opts))
322 323
     return output
323 324
 get_sql_initial_data.help_doc = "Prints the initial INSERT SQL statements for the given app name(s)."
324 325
 get_sql_initial_data.args = APP_ARGS
@@ -1164,7 +1165,7 @@ def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING):
1164 1165
             action_mapping[action](username, email, password)
1165 1166
     elif action == 'shell':
1166 1167
         action_mapping[action](options.plain is True)
1167  
-    elif action in ('init', 'init-minimal', 'validate'):
  1168
+    elif action in ('init', 'validate'):
1168 1169
         action_mapping[action]()
1169 1170
     elif action == 'inspectdb':
1170 1171
         try:
16  tests/runtests.py
@@ -89,7 +89,7 @@ def run_tests(self):
89 89
                 test_models = []
90 90
         else:
91 91
             run_othertests = not self.which_tests
92  
-            
  92
+
93 93
         if self.which_tests:
94 94
             # Only run the specified tests.
95 95
             bad_models = [m for m in self.which_tests if m not in test_models]
@@ -133,8 +133,6 @@ def run_tests(self):
133 133
 
134 134
         # Initialize the test database.
135 135
         cursor = connection.cursor()
136  
-        self.output(1, "Initializing test database")
137  
-        management.init_minimal()
138 136
 
139 137
         # Run the tests for each test model.
140 138
         self.output(1, "Running app tests")
@@ -146,7 +144,7 @@ def run_tests(self):
146 144
             except Exception, e:
147 145
                 log_error(model_name, "Error while importing", ''.join(traceback.format_exception(*sys.exc_info())[1:]))
148 146
                 continue
149  
-                
  147
+
150 148
             if not getattr(mod, 'error_log', None):
151 149
                 # Model is not marked as an invalid model
152 150
                 self.output(1, "%s model: Installing" % model_name)
@@ -162,10 +160,10 @@ def run_tests(self):
162 160
                 runner = DjangoDoctestRunner(verbosity_level=verbosity_level, verbose=False)
163 161
                 self.output(1, "%s model: Running tests" % model_name)
164 162
                 runner.run(dtest, clear_globs=True, out=sys.stdout.write)
165  
-            else: 
  163
+            else:
166 164
                 # Check that model known to be invalid is invalid for the right reasons.
167 165
                 self.output(1, "%s model: Validating" % model_name)
168  
-            
  166
+
169 167
                 from cStringIO import StringIO
170 168
                 s = StringIO()
171 169
                 count = management.get_validation_errors(s, mod)
@@ -173,10 +171,10 @@ def run_tests(self):
173 171
                 error_log = s.read()
174 172
                 actual = error_log.split('\n')
175 173
                 expected = mod.error_log.split('\n')
176  
-                                    
177  
-                unexpected = [err for err in actual if err not in expected]    
  174
+
  175
+                unexpected = [err for err in actual if err not in expected]
178 176
                 missing = [err for err in expected if err not in actual]
179  
-                
  177
+
180 178
                 if unexpected or missing:
181 179
                     unexpected_log = '\n'.join(unexpected)
182 180
                     missing_log = '\n'.join(missing)

0 notes on commit 65dc8f0

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