diff --git a/django/core/management.py b/django/core/management.py index a519c814d8..f86c357bcd 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -297,15 +297,13 @@ def get_sql_initial_data(app): output = [] app_models = get_models(app) - app_label = app_models[0]._meta.app_label - output.append(_get_packages_insert(app_label)) app_dir = os.path.normpath(os.path.join(os.path.dirname(app.__file__), 'sql')) for klass in app_models: opts = klass._meta # Add custom SQL, if it's available. - # FIXME: This probably needs changing + # TODO: This probably needs changing sql_files = [os.path.join(app_dir, opts.module_name + '.' + settings.DATABASE_ENGINE + '.sql'), os.path.join(app_dir, opts.module_name + '.sql')] for sql_file in sql_files: @@ -314,11 +312,14 @@ def get_sql_initial_data(app): output.append(fp.read()) fp.close() - # Content types. - output.append(_get_contenttype_insert(opts)) - # Permissions. - for codename, name in _get_all_permissions(opts): - output.append(_get_permission_insert(name, codename, opts)) + # TODO: This is temporarily commented out until we come up + # with a better way of letting people initialize content types and + # permissions. +# # Content types. +# output.append(_get_contenttype_insert(opts)) +# # Permissions. +# for codename, name in _get_all_permissions(opts): +# output.append(_get_permission_insert(name, codename, opts)) return output get_sql_initial_data.help_doc = "Prints the initial INSERT SQL statements for the given app name(s)." get_sql_initial_data.args = APP_ARGS @@ -1164,7 +1165,7 @@ def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING): action_mapping[action](username, email, password) elif action == 'shell': action_mapping[action](options.plain is True) - elif action in ('init', 'init-minimal', 'validate'): + elif action in ('init', 'validate'): action_mapping[action]() elif action == 'inspectdb': try: diff --git a/tests/runtests.py b/tests/runtests.py index e88ffd933c..d783fe151b 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -89,7 +89,7 @@ class TestRunner: test_models = [] else: run_othertests = not self.which_tests - + if self.which_tests: # Only run the specified tests. bad_models = [m for m in self.which_tests if m not in test_models] @@ -133,8 +133,6 @@ class TestRunner: # Initialize the test database. cursor = connection.cursor() - self.output(1, "Initializing test database") - management.init_minimal() # Run the tests for each test model. self.output(1, "Running app tests") @@ -146,7 +144,7 @@ class TestRunner: except Exception, e: log_error(model_name, "Error while importing", ''.join(traceback.format_exception(*sys.exc_info())[1:])) continue - + if not getattr(mod, 'error_log', None): # Model is not marked as an invalid model self.output(1, "%s model: Installing" % model_name) @@ -162,10 +160,10 @@ class TestRunner: runner = DjangoDoctestRunner(verbosity_level=verbosity_level, verbose=False) self.output(1, "%s model: Running tests" % model_name) runner.run(dtest, clear_globs=True, out=sys.stdout.write) - else: + else: # Check that model known to be invalid is invalid for the right reasons. self.output(1, "%s model: Validating" % model_name) - + from cStringIO import StringIO s = StringIO() count = management.get_validation_errors(s, mod) @@ -173,10 +171,10 @@ class TestRunner: error_log = s.read() actual = error_log.split('\n') expected = mod.error_log.split('\n') - - unexpected = [err for err in actual if err not in expected] + + unexpected = [err for err in actual if err not in expected] missing = [err for err in expected if err not in actual] - + if unexpected or missing: unexpected_log = '\n'.join(unexpected) missing_log = '\n'.join(missing)