summaryrefslogtreecommitdiff
path: root/tests/regressiontests/bug8245/tests.py
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2008-12-23 18:25:24 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2008-12-23 18:25:24 +0000
commit9af56803f53a4e41bb826d4e293ef8650ad9f13a (patch)
tree8156c35362dc9ff13bcfe8c1f088105265ab8a24 /tests/regressiontests/bug8245/tests.py
parentf0d44e44bd4161d279ea9b6a9c99af79cf17b913 (diff)
Fixed #8245 -- Added a LOADING flag to autodiscover to prevent an admin.py module with errors from raising a spurious AlreadyRegistered exception in a subsequent call to autodiscover.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9680 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/bug8245/tests.py')
-rw-r--r--tests/regressiontests/bug8245/tests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/regressiontests/bug8245/tests.py b/tests/regressiontests/bug8245/tests.py
new file mode 100644
index 0000000000..c1cc3b595c
--- /dev/null
+++ b/tests/regressiontests/bug8245/tests.py
@@ -0,0 +1,23 @@
+from unittest import TestCase
+
+from django.contrib import admin
+
+
+class Bug8245Test(TestCase):
+ """
+ Test for bug #8245 - don't raise an AlreadyRegistered exception when using
+ autodiscover() and an admin.py module contains an error.
+ """
+
+ def test_bug_8245(self):
+ # The first time autodiscover is called, we should get our real error.
+ try:
+ admin.autodiscover()
+ except Exception, e:
+ self.failUnlessEqual(str(e), "Bad admin module")
+ else:
+ self.fail(
+ 'autodiscover should have raised a "Bad admin module" error.')
+ # Calling autodiscover again should bail out early and not raise an
+ # AlreadyRegistered error.
+ admin.autodiscover()