From 38ce41103fecf58418163b19403608988a291b56 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sun, 29 Dec 2013 21:24:40 +0100 Subject: [PATCH] Used Apps.clear_cache() in tests that alter the app registry. --- tests/app_loading/tests.py | 2 +- tests/managers_regress/tests.py | 6 +++--- tests/migrations/test_commands.py | 2 +- tests/proxy_models/tests.py | 2 +- tests/runtests.py | 2 +- tests/tablespaces/tests.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/app_loading/tests.py b/tests/app_loading/tests.py index fddf75f30e9..5219b5315d7 100644 --- a/tests/app_loading/tests.py +++ b/tests/app_loading/tests.py @@ -21,7 +21,7 @@ class EggLoadingTest(TestCase): def tearDown(self): apps.all_models['app_loading'] = self._old_models - apps.get_models.cache_clear() + apps.clear_cache() sys.path = self.old_path diff --git a/tests/managers_regress/tests.py b/tests/managers_regress/tests.py index 8e0b4cd0176..0d24873a102 100644 --- a/tests/managers_regress/tests.py +++ b/tests/managers_regress/tests.py @@ -128,7 +128,7 @@ class ManagersRegressionTests(TestCase): finally: apps.app_configs['managers_regress'].models = _old_models apps.all_models['managers_regress'] = _old_models - apps.get_models.cache_clear() + apps.clear_cache() @override_settings(TEST_SWAPPABLE_MODEL='managers_regress.Parent') def test_custom_swappable_manager(self): @@ -156,7 +156,7 @@ class ManagersRegressionTests(TestCase): finally: apps.app_configs['managers_regress'].models = _old_models apps.all_models['managers_regress'] = _old_models - apps.get_models.cache_clear() + apps.clear_cache() @override_settings(TEST_SWAPPABLE_MODEL='managers_regress.Parent') def test_explicit_swappable_manager(self): @@ -184,7 +184,7 @@ class ManagersRegressionTests(TestCase): finally: apps.app_configs['managers_regress'].models = _old_models apps.all_models['managers_regress'] = _old_models - apps.get_models.cache_clear() + apps.clear_cache() def test_regress_3871(self): related = RelatedModel.objects.create() diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index 3219a62f5ac..e53b26c6380 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -136,7 +136,7 @@ class MakeMigrationsTests(MigrationTestBase): def tearDown(self): apps.app_configs['migrations'].models = self._old_models apps.all_models['migrations'] = self._old_models - apps.get_models.cache_clear() + apps.clear_cache() os.chdir(self.test_dir) try: diff --git a/tests/proxy_models/tests.py b/tests/proxy_models/tests.py index fe294aeb1e8..0f2b5349be5 100644 --- a/tests/proxy_models/tests.py +++ b/tests/proxy_models/tests.py @@ -175,7 +175,7 @@ class ProxyModelTests(TestCase): finally: apps.app_configs['proxy_models'].models = _old_models apps.all_models['proxy_models'] = _old_models - apps.get_models.cache_clear() + apps.clear_cache() def test_myperson_manager(self): Person.objects.create(name="fred") diff --git a/tests/runtests.py b/tests/runtests.py index 3998a7bf92c..4c917fbbed8 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -168,7 +168,7 @@ def setup(verbosity, test_labels): app_config = AppConfig.create(module_label) app_config.import_models(apps.all_models[app_config.label]) apps.app_configs[app_config.label] = app_config - apps.get_models.cache_clear() + apps.clear_cache() return state diff --git a/tests/tablespaces/tests.py b/tests/tablespaces/tests.py index 5e22608551e..8c69e70a19a 100644 --- a/tests/tablespaces/tests.py +++ b/tests/tablespaces/tests.py @@ -37,7 +37,7 @@ class TablespacesTests(TestCase): apps.app_configs['tablespaces'].models = self._old_models apps.all_models['tablespaces'] = self._old_models - apps.get_models.cache_clear() + apps.clear_cache() def assertNumContains(self, haystack, needle, count): real_count = haystack.count(needle)