Used Apps.clear_cache() in tests that alter the app registry.
This commit is contained in:
parent
8cfcd801c4
commit
38ce41103f
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue