1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Stopped iterating on INSTALLED_APPS.

Used the app cache's get_app_configs() method instead.
This commit is contained in:
Aymeric Augustin
2013-12-19 15:57:23 +01:00
parent d4733b6df0
commit 65cd74be8e
18 changed files with 116 additions and 82 deletions

View File

@@ -5,7 +5,7 @@ import os
import sys
import unittest
from django.conf import settings
from django.core.apps import app_cache
from django.core.management import ManagementUtility
from django.utils.six import StringIO
@@ -84,5 +84,7 @@ class BashCompletionTests(unittest.TestCase):
"Application names will be autocompleted for an AppCommand"
self._user_input('django-admin.py sqlall a')
output = self._run_autocomplete()
app_labels = [name.split('.')[-1] for name in settings.INSTALLED_APPS]
self.assertEqual(output, sorted(label for label in app_labels if label.startswith('a')))
a_labels = sorted(app_config.label
for app_config in app_cache.get_app_configs()
if app_config.label.startswith('a'))
self.assertEqual(output, a_labels)