1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Replaced ad-hoc caching of get_models with lru_cache.

Invalidate properly the cache whenever all_models or app_configs change.
This fixes some isolation issues in the test suite.
This commit is contained in:
Aymeric Augustin
2013-12-24 10:08:04 +01:00
parent 2ec8e3443b
commit 82a35e24d4
8 changed files with 15 additions and 27 deletions

View File

@@ -37,7 +37,7 @@ class TablespacesTests(TestCase):
app_cache.app_configs['tablespaces'].models = self._old_models
app_cache.all_models['tablespaces'] = self._old_models
app_cache._get_models_cache = {}
app_cache.get_models.cache_clear()
def assertNumContains(self, haystack, needle, count):
real_count = haystack.count(needle)