1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #34687 -- Made Apps.clear_cache() clear get_swappable_settings_name() cache.

This commit is contained in:
sobolevn
2023-06-29 16:13:14 +03:00
committed by Mariusz Felisiak
parent 953f29f700
commit 5820fc4485
3 changed files with 13 additions and 0 deletions

View File

@@ -197,6 +197,17 @@ class AppsTests(SimpleTestCase):
with self.assertRaises(ValueError):
apps.get_model("admin_LogEntry")
@override_settings(INSTALLED_APPS=SOME_INSTALLED_APPS)
def test_clear_cache(self):
# Set cache.
self.assertIsNone(apps.get_swappable_settings_name("admin.LogEntry"))
apps.get_models()
apps.clear_cache()
self.assertEqual(apps.get_swappable_settings_name.cache_info().currsize, 0)
self.assertEqual(apps.get_models.cache_info().currsize, 0)
@override_settings(INSTALLED_APPS=["apps.apps.RelabeledAppsConfig"])
def test_relabeling(self):
self.assertEqual(apps.get_app_config("relabeled").name, "apps")