mirror of
https://github.com/django/django.git
synced 2025-05-11 09:26:29 +00:00
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
This commit is contained in:
parent
39e4e8ce5a
commit
65dc8f000b
@ -297,15 +297,13 @@ def get_sql_initial_data(app):
|
|||||||
output = []
|
output = []
|
||||||
|
|
||||||
app_models = get_models(app)
|
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'))
|
app_dir = os.path.normpath(os.path.join(os.path.dirname(app.__file__), 'sql'))
|
||||||
|
|
||||||
for klass in app_models:
|
for klass in app_models:
|
||||||
opts = klass._meta
|
opts = klass._meta
|
||||||
|
|
||||||
# Add custom SQL, if it's available.
|
# 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'),
|
sql_files = [os.path.join(app_dir, opts.module_name + '.' + settings.DATABASE_ENGINE + '.sql'),
|
||||||
os.path.join(app_dir, opts.module_name + '.sql')]
|
os.path.join(app_dir, opts.module_name + '.sql')]
|
||||||
for sql_file in sql_files:
|
for sql_file in sql_files:
|
||||||
@ -314,11 +312,14 @@ def get_sql_initial_data(app):
|
|||||||
output.append(fp.read())
|
output.append(fp.read())
|
||||||
fp.close()
|
fp.close()
|
||||||
|
|
||||||
# Content types.
|
# TODO: This is temporarily commented out until we come up
|
||||||
output.append(_get_contenttype_insert(opts))
|
# with a better way of letting people initialize content types and
|
||||||
# Permissions.
|
# permissions.
|
||||||
for codename, name in _get_all_permissions(opts):
|
# # Content types.
|
||||||
output.append(_get_permission_insert(name, codename, opts))
|
# 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
|
return output
|
||||||
get_sql_initial_data.help_doc = "Prints the initial INSERT SQL statements for the given app name(s)."
|
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
|
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)
|
action_mapping[action](username, email, password)
|
||||||
elif action == 'shell':
|
elif action == 'shell':
|
||||||
action_mapping[action](options.plain is True)
|
action_mapping[action](options.plain is True)
|
||||||
elif action in ('init', 'init-minimal', 'validate'):
|
elif action in ('init', 'validate'):
|
||||||
action_mapping[action]()
|
action_mapping[action]()
|
||||||
elif action == 'inspectdb':
|
elif action == 'inspectdb':
|
||||||
try:
|
try:
|
||||||
|
@ -133,8 +133,6 @@ class TestRunner:
|
|||||||
|
|
||||||
# Initialize the test database.
|
# Initialize the test database.
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
self.output(1, "Initializing test database")
|
|
||||||
management.init_minimal()
|
|
||||||
|
|
||||||
# Run the tests for each test model.
|
# Run the tests for each test model.
|
||||||
self.output(1, "Running app tests")
|
self.output(1, "Running app tests")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user