diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-11 23:31:34 +0100 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-17 10:17:44 +0100 |
commit | 8662654d6d50e4d89f771a757ae5fc83c6b74db0 (patch) | |
tree | 1b9d98842d25a5d15a389bcc0dcefdc4fcffef4f /tests/managers_regress | |
parent | 334551339de38569ac3530886e3f9cc681190224 (diff) | |
download | django-8662654d6d50e4d89f771a757ae5fc83c6b74db0.tar.gz |
Removed module-level functions for the app cache.
Since the original ones in django.db.models.loading were kept only for
backwards compatibility, there's no need to recreate them. However, many
internals of Django still relied on them.
They were also imported in django.db.models. They never appear in the
documentation, except a quick mention of get_models and get_app in the
1.2 release notes to document an edge case in GIS. I don't think that
makes them a public API.
This commit doesn't change the overall amount of global state but
clarifies that it's tied to the app_cache object instead of hiding it
behind half a dozen functions.
Diffstat (limited to 'tests/managers_regress')
-rw-r--r-- | tests/managers_regress/tests.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/managers_regress/tests.py b/tests/managers_regress/tests.py index 25717f7431..de9f72c333 100644 --- a/tests/managers_regress/tests.py +++ b/tests/managers_regress/tests.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals import copy -from django.apps.cache import cache +from django.apps import app_cache from django.db import models from django.template import Context, Template from django.test import TestCase @@ -114,7 +114,7 @@ class ManagersRegressionTests(TestCase): # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. - old_app_models = copy.deepcopy(cache.app_models) + old_app_models = copy.deepcopy(app_cache.app_models) class SwappableModel(models.Model): class Meta: @@ -129,7 +129,7 @@ class ManagersRegressionTests(TestCase): self.assertEqual(str(e), "Manager isn't available; SwappableModel has been swapped for 'managers_regress.Parent'") finally: - cache.app_models = old_app_models + app_cache.app_models = old_app_models @override_settings(TEST_SWAPPABLE_MODEL='managers_regress.Parent') def test_custom_swappable_manager(self): @@ -137,7 +137,7 @@ class ManagersRegressionTests(TestCase): # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. - old_app_models = copy.deepcopy(cache.app_models) + old_app_models = copy.deepcopy(app_cache.app_models) class SwappableModel(models.Model): @@ -156,7 +156,7 @@ class ManagersRegressionTests(TestCase): self.assertEqual(str(e), "Manager isn't available; SwappableModel has been swapped for 'managers_regress.Parent'") finally: - cache.app_models = old_app_models + app_cache.app_models = old_app_models @override_settings(TEST_SWAPPABLE_MODEL='managers_regress.Parent') def test_explicit_swappable_manager(self): @@ -164,7 +164,7 @@ class ManagersRegressionTests(TestCase): # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. - old_app_models = copy.deepcopy(cache.app_models) + old_app_models = copy.deepcopy(app_cache.app_models) class SwappableModel(models.Model): @@ -183,7 +183,7 @@ class ManagersRegressionTests(TestCase): self.assertEqual(str(e), "Manager isn't available; SwappableModel has been swapped for 'managers_regress.Parent'") finally: - cache.app_models = old_app_models + app_cache.app_models = old_app_models def test_regress_3871(self): related = RelatedModel.objects.create() |