summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGabriel Hurley <gabehr@gmail.com>2011-09-22 21:09:00 +0000
committerGabriel Hurley <gabehr@gmail.com>2011-09-22 21:09:00 +0000
commit39bbd1653a7d7b55476c529afad9d6932ee9d8ca (patch)
tree9b4a56c14c70073b61f02ffc7c6db2483f142f1b /tests
parentbb641631e5e67d5bef431bee39746a7418b6af1e (diff)
Fixed #7198 (again) -- Corrects a problem with string interpolation from r16876 and adds tests for the new error message.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16888 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/empty/no_models/__init__.py0
-rw-r--r--tests/modeltests/empty/no_models/tests.py5
-rw-r--r--tests/modeltests/empty/tests.py22
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/modeltests/empty/no_models/__init__.py b/tests/modeltests/empty/no_models/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/modeltests/empty/no_models/__init__.py
diff --git a/tests/modeltests/empty/no_models/tests.py b/tests/modeltests/empty/no_models/tests.py
new file mode 100644
index 0000000000..7b892bcaca
--- /dev/null
+++ b/tests/modeltests/empty/no_models/tests.py
@@ -0,0 +1,5 @@
+from django.test import TestCase
+
+class NoModelTests(TestCase):
+ """ A placeholder test case. See modeltests.empty.tests for more info. """
+ pass
diff --git a/tests/modeltests/empty/tests.py b/tests/modeltests/empty/tests.py
index 01fa1c58cd..b3a8a72ad2 100644
--- a/tests/modeltests/empty/tests.py
+++ b/tests/modeltests/empty/tests.py
@@ -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 @@ class EmptyModelTests(TestCase):
self.assertTrue(m.id is not None)
existing = Empty(m.id)
existing.save()
+
+class NoModelTests(TestCase):
+ """
+ Test for #7198 to ensure that the proper error message is raised
+ when attempting to load an app with no models.py file.
+
+ Becuase the test runner won't currently load a test module with no
+ models.py 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 models.py module.'):
+ get_app('no_models')