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

Renamed AppCache to Apps.

Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
This commit is contained in:
Aymeric Augustin
2013-12-24 12:25:17 +01:00
parent e9e522a8e7
commit 1716b7ce5a
92 changed files with 491 additions and 487 deletions

View File

@@ -5,7 +5,7 @@ import codecs
import os
import shutil
from django.apps import app_cache
from django.apps import apps
from django.core.management import call_command, CommandError
from django.test import override_settings
from django.utils import six
@@ -131,12 +131,12 @@ class MakeMigrationsTests(MigrationTestBase):
self.test_dir = os.path.abspath(os.path.dirname(upath(__file__)))
self.migration_dir = os.path.join(self.test_dir, 'migrations_%d' % self.creation_counter)
self.migration_pkg = "migrations.migrations_%d" % self.creation_counter
self._old_models = app_cache.app_configs['migrations'].models.copy()
self._old_models = apps.app_configs['migrations'].models.copy()
def tearDown(self):
app_cache.app_configs['migrations'].models = self._old_models
app_cache.all_models['migrations'] = self._old_models
app_cache.get_models.cache_clear()
apps.app_configs['migrations'].models = self._old_models
apps.all_models['migrations'] = self._old_models
apps.get_models.cache_clear()
os.chdir(self.test_dir)
try:
@@ -152,7 +152,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_files_content(self):
self.assertTableNotExists("migrations_unicodemodel")
app_cache.register_model('migrations', UnicodeModel)
apps.register_model('migrations', UnicodeModel)
with override_settings(MIGRATION_MODULES={"migrations": self.migration_pkg}):
call_command("makemigrations", "migrations", verbosity=0)
@@ -188,7 +188,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_failing_migration(self):
#21280 - If a migration fails to serialize, it shouldn't generate an empty file.
app_cache.register_model('migrations', UnserializableModel)
apps.register_model('migrations', UnserializableModel)
with six.assertRaisesRegex(self, ValueError, r'Cannot serialize'):
with override_settings(MIGRATION_MODULES={"migrations": self.migration_pkg}):