mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #29768 -- Improved error message when an AppConfig has a typo in INSTALLED_APPS.
This commit is contained in:
parent
2349cbd909
commit
40c8ffad72
2 changed files with 27 additions and 6 deletions
|
@ -81,10 +81,18 @@ class AppsTests(SimpleTestCase):
|
|||
pass
|
||||
|
||||
def test_no_such_app_config(self):
|
||||
"""
|
||||
Tests when INSTALLED_APPS contains an entry that doesn't exist.
|
||||
"""
|
||||
with self.assertRaises(ImportError):
|
||||
msg = "No module named 'apps.NoSuchConfig'"
|
||||
with self.assertRaisesMessage(ImportError, msg):
|
||||
with self.settings(INSTALLED_APPS=['apps.NoSuchConfig']):
|
||||
pass
|
||||
|
||||
def test_no_such_app_config_with_choices(self):
|
||||
msg = (
|
||||
"'apps.apps' does not contain a class 'NoSuchConfig'. Choices are: "
|
||||
"'BadConfig', 'MyAdmin', 'MyAuth', 'NoSuchApp', 'PlainAppsConfig', "
|
||||
"'RelabeledAppsConfig'."
|
||||
)
|
||||
with self.assertRaisesMessage(ImproperlyConfigured, msg):
|
||||
with self.settings(INSTALLED_APPS=['apps.apps.NoSuchConfig']):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue