diff options
author | Marten Kenbeek <marten.knbk@gmail.com> | 2018-09-18 18:19:18 +0200 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-09-26 16:12:21 -0400 |
commit | 40c8ffad7249fd37ca1629f06d3ab6b129d84b21 (patch) | |
tree | c0d443faee1cb04f95ee2f70f64bce04a010327f /tests/apps | |
parent | 2349cbd909c387d2d05cda20ce8d0c63c1b1c6c4 (diff) | |
download | django-40c8ffad7249fd37ca1629f06d3ab6b129d84b21.tar.gz |
Fixed #29768 -- Improved error message when an AppConfig has a typo in INSTALLED_APPS.
Diffstat (limited to 'tests/apps')
-rw-r--r-- | tests/apps/tests.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/apps/tests.py b/tests/apps/tests.py index 2fec1d8b4c..cd22a4d45c 100644 --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -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 |