From 287e36bd227a694ba008c28fda1904fbe92df123 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 11 Aug 2020 10:31:09 +0200 Subject: [PATCH] Refs #31180 -- Fixed unreachable assertions in apps tests. --- tests/apps/tests.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/apps/tests.py b/tests/apps/tests.py index cf487a65da..26d135f244 100644 --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -501,8 +501,13 @@ class DeprecationTests(SimpleTestCase): ) with self.assertRaisesMessage(RemovedInDjango41Warning, msg): with self.settings(INSTALLED_APPS=['apps.explicit_default_config_app']): - config = apps.get_app_config('explicit_default_config_app') - self.assertIsInstance(config, ExplicitDefaultConfig) + pass + with ignore_warnings(category=RemovedInDjango41Warning): + with self.settings(INSTALLED_APPS=['apps.explicit_default_config_app']): + self.assertIsInstance( + apps.get_app_config('explicit_default_config_app'), + ExplicitDefaultConfig, + ) def test_explicit_default_app_config_mismatch(self): """ @@ -522,8 +527,13 @@ class DeprecationTests(SimpleTestCase): ) with self.assertRaisesMessage(RemovedInDjango41Warning, msg): with self.settings(INSTALLED_APPS=['apps.explicit_default_config_mismatch_app']): - config = apps.get_app_config('explicit_default_config_mismatch_app') - self.assertIsInstance(config, ExplicitDefaultConfigMismatch) + pass + with ignore_warnings(category=RemovedInDjango41Warning): + with self.settings(INSTALLED_APPS=['apps.explicit_default_config_mismatch_app']): + self.assertIsInstance( + apps.get_app_config('explicit_default_config_mismatch_app'), + ExplicitDefaultConfigMismatch, + ) def test_explicit_default_app_config_empty_apps(self): """