mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +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:
@@ -19,16 +19,6 @@ class SwappableModelTests(TestCase):
|
||||
'django.contrib.contenttypes',
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
# This test modifies the installed apps, so we need to make sure
|
||||
# we're not dealing with a cached app list.
|
||||
app_cache._get_models_cache.clear()
|
||||
|
||||
def tearDown(self):
|
||||
# By fiddling with swappable models, we alter the installed models
|
||||
# cache, so flush it to make sure there are no side effects.
|
||||
app_cache._get_models_cache.clear()
|
||||
|
||||
@override_settings(TEST_ARTICLE_MODEL='swappable_models.AlternateArticle')
|
||||
def test_generated_data(self):
|
||||
"Permissions and content types are not created for a swapped model"
|
||||
|
||||
Reference in New Issue
Block a user