Explorar o código

Used Apps.clear_cache() in tests that alter the app registry.

Aymeric Augustin %!s(int64=11) %!d(string=hai) anos
pai
achega
38ce41103f

+ 1 - 1
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
 

+ 3 - 3
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()

+ 1 - 1
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:

+ 1 - 1
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")

+ 1 - 1
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
 

+ 1 - 1
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)