Skip to content
Browse files

Fixed #7198 (again) -- Corrects a problem with string interpolation f…

…rom r16876 and adds tests for the new error message.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent bb64163 commit 39bbd1653a7d7b55476c529afad9d6932ee9d8ca Gabriel Hurley committed
2 django/db/models/
@@ -146,7 +146,7 @@ def get_app(self, app_label, emptyOK=False):
if mod is None:
if emptyOK:
return None
- raise ImproperlyConfigured("App with label %s is missing a module.")
+ raise ImproperlyConfigured("App with label %s is missing a module." % app_label)
return mod
raise ImproperlyConfigured("App with label %s could not be found" % app_label)
0 tests/modeltests/empty/no_models/
No changes.
5 tests/modeltests/empty/no_models/
@@ -0,0 +1,5 @@
+from django.test import TestCase
+class NoModelTests(TestCase):
+ """ A placeholder test case. See modeltests.empty.tests for more info. """
+ pass
22 tests/modeltests/empty/
@@ -1,4 +1,10 @@
+from __future__ import with_statement
+from django.conf import settings
+from django.core.exceptions import ImproperlyConfigured
+from django.db.models.loading import get_app
from django.test import TestCase
+from django.test.utils import override_settings
from models import Empty
@@ -13,3 +19,19 @@ def test_empty(self):
self.assertTrue( is not None)
existing = Empty(
+class NoModelTests(TestCase):
+ """
+ Test for #7198 to ensure that the proper error message is raised
+ when attempting to load an app with no file.
+ Becuase the test runner won't currently load a test module with no
+ file, this TestCase instead lives in this module.
+ It seemed like an appropriate home for it.
+ """
+ @override_settings(INSTALLED_APPS=("modeltests.empty.no_models",))
+ def test_no_models(self):
+ with self.assertRaisesRegexp(ImproperlyConfigured,
+ 'App with label no_models is missing a module.'):
+ get_app('no_models')

0 comments on commit 39bbd16

Please sign in to comment.
Something went wrong with that request. Please try again.