Django

Code

Changeset 2387

Show
Ignore:
Timestamp:
02/24/06 22:46:06 (3 years ago)
Author:
adrian
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/django/core/management.py

    r2386 r2387  
    298298 
    299299    app_models = get_models(app) 
    300     app_label = app_models[0]._meta.app_label 
    301     output.append(_get_packages_insert(app_label)) 
    302300    app_dir = os.path.normpath(os.path.join(os.path.dirname(app.__file__), 'sql')) 
    303301 
     
    306304 
    307305        # Add custom SQL, if it's available. 
    308         # FIXME: This probably needs changing 
     306        # TODO: This probably needs changing 
    309307        sql_files = [os.path.join(app_dir, opts.module_name + '.' + settings.DATABASE_ENGINE +  '.sql'), 
    310308                     os.path.join(app_dir, opts.module_name + '.sql')] 
     
    315313                fp.close() 
    316314 
    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)) 
    322323    return output 
    323324get_sql_initial_data.help_doc = "Prints the initial INSERT SQL statements for the given app name(s)." 
     
    11651166    elif action == 'shell': 
    11661167        action_mapping[action](options.plain is True) 
    1167     elif action in ('init', 'init-minimal', 'validate'): 
     1168    elif action in ('init', 'validate'): 
    11681169        action_mapping[action]() 
    11691170    elif action == 'inspectdb': 
  • django/branches/magic-removal/tests/runtests.py

    r2339 r2387  
    9090        else: 
    9191            run_othertests = not self.which_tests 
    92              
     92 
    9393        if self.which_tests: 
    9494            # Only run the specified tests. 
     
    134134        # Initialize the test database. 
    135135        cursor = connection.cursor() 
    136         self.output(1, "Initializing test database") 
    137         management.init_minimal() 
    138136 
    139137        # Run the tests for each test model. 
     
    147145                log_error(model_name, "Error while importing", ''.join(traceback.format_exception(*sys.exc_info())[1:])) 
    148146                continue 
    149                  
     147 
    150148            if not getattr(mod, 'error_log', None): 
    151149                # Model is not marked as an invalid model 
     
    163161                self.output(1, "%s model: Running tests" % model_name) 
    164162                runner.run(dtest, clear_globs=True, out=sys.stdout.write) 
    165             else:  
     163            else: 
    166164                # Check that model known to be invalid is invalid for the right reasons. 
    167165                self.output(1, "%s model: Validating" % model_name) 
    168              
     166 
    169167                from cStringIO import StringIO 
    170168                s = StringIO() 
     
    174172                actual = error_log.split('\n') 
    175173                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] 
    178176                missing = [err for err in expected if err not in actual] 
    179                  
     177 
    180178                if unexpected or missing: 
    181179                    unexpected_log = '\n'.join(unexpected)