diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-20 10:44:32 +0100 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-22 11:39:18 +0100 |
commit | 517c24bcfabcc704a6b3b3f1eb39b05a3cf41954 (patch) | |
tree | 339f995cfc207ca021dbf098a7eca01dfc363b72 /tests/app_loading | |
parent | 16aae35ca8508dff2e0b94da67b8c880fe98e9d1 (diff) | |
download | django-517c24bcfabcc704a6b3b3f1eb39b05a3cf41954.tar.gz |
Complained on override_settings(INSTALLED_APPS=...).
Currently such overrides aren't reflected in the app cache.
It would be possible to handle them. But that doesn't look like a very
good API. It makes it complicated to express "add this app" and "remove
this app", which are the most common operations on INSTALLED_APPS.
Diffstat (limited to 'tests/app_loading')
-rw-r--r-- | tests/app_loading/tests.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/app_loading/tests.py b/tests/app_loading/tests.py index bb71ad84a2..dcd0fa34c0 100644 --- a/tests/app_loading/tests.py +++ b/tests/app_loading/tests.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import os import sys from unittest import TestCase +import warnings from django.core.apps import app_cache from django.core.apps.cache import AppCache @@ -77,11 +78,13 @@ class EggLoadingTest(TestCase): # Pretend we're the master app cache to test the population process. app_cache._apps_loaded = False app_cache._models_loaded = False - with override_settings(INSTALLED_APPS=('notexists',)): - with self.assertRaises(ImportError): - app_cache.get_model('notexists', 'nomodel') - with self.assertRaises(ImportError): - app_cache.get_model('notexists', 'nomodel') + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", "Overriding setting INSTALLED_APPS") + with override_settings(INSTALLED_APPS=['notexists']): + with self.assertRaises(ImportError): + app_cache.get_model('notexists', 'nomodel') + with self.assertRaises(ImportError): + app_cache.get_model('notexists', 'nomodel') class GetModelsTest(TestCase): |