mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Made runtests.py use 'set_installed_apps' API
This will also trigger the ready method of any tested application, which was not run before.
This commit is contained in:
parent
f01d2a8f9b
commit
19b4908206
@ -143,6 +143,7 @@ def setup(verbosity, test_labels):
|
||||
bits = bits[:1]
|
||||
test_labels_set.add('.'.join(bits))
|
||||
|
||||
installed_app_names = set(get_installed())
|
||||
for modpath, module_name in test_modules:
|
||||
if modpath:
|
||||
module_label = '.'.join([modpath, module_name])
|
||||
@ -159,16 +160,12 @@ def setup(verbosity, test_labels):
|
||||
module_label == label or module_label.startswith(label + '.')
|
||||
for label in test_labels_set)
|
||||
|
||||
installed_app_names = set(get_installed())
|
||||
if module_found_in_labels and module_label not in installed_app_names:
|
||||
if verbosity >= 2:
|
||||
print("Importing application %s" % module_name)
|
||||
# HACK.
|
||||
settings.INSTALLED_APPS.append(module_label)
|
||||
app_config = AppConfig.create(module_label)
|
||||
apps.app_configs[app_config.label] = app_config
|
||||
app_config.import_models(apps.all_models[app_config.label])
|
||||
apps.clear_cache()
|
||||
|
||||
apps.set_installed_apps(settings.INSTALLED_APPS)
|
||||
|
||||
return state
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user