diff options
| author | David Sanders <shang.xiao.sanders@gmail.com> | 2023-09-24 19:02:50 +1000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-09-25 08:17:03 +0200 |
| commit | 4f2ae0644de34791b84b7beb11a966ce4bc48fb6 (patch) | |
| tree | f4bf5c6d4b2cb780f4f006e1175307ca964e5338 /tests/apps/tests.py | |
| parent | 574ee4023e15cfb195833edfbaed353f8021c62f (diff) | |
Fixed #34849 -- Avoided raising RuntimeWarning about import-time queries when apps are reinitialized with test tools.
Regression in fbd16438f46bc2128926958ad24331da5d1b406f.
Diffstat (limited to 'tests/apps/tests.py')
| -rw-r--r-- | tests/apps/tests.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/apps/tests.py b/tests/apps/tests.py index e443e37dc5..fba9c43a34 100644 --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -607,10 +607,9 @@ class QueryPerformingAppTests(TransactionTestCase): custom_settings = override_settings( INSTALLED_APPS=[f"apps.query_performing_app.apps.{app_config_name}"] ) - # Ignore the RuntimeWarning, as override_settings.enable() calls - # AppConfig.ready() which will trigger the warning. - with self.assertWarnsMessage(RuntimeWarning, self.expected_msg): - custom_settings.enable() + custom_settings.enable() + old_stored_app_configs = apps.stored_app_configs + apps.stored_app_configs = [] try: with patch.multiple(apps, ready=False, loading=False, app_configs={}): with self.assertWarnsMessage(RuntimeWarning, self.expected_msg): @@ -619,4 +618,5 @@ class QueryPerformingAppTests(TransactionTestCase): app_config = apps.get_app_config("query_performing_app") return app_config.query_results finally: + setattr(apps, "stored_app_configs", old_stored_app_configs) custom_settings.disable() |
