Commits

Georg Brandl  committed 758465d Merge

Merged in kushou/sphinx (pull request #80)

  • Participants
  • Parent commits 0af2444, d4718ee

Comments (0)

Files changed (2)

File sphinx/application.py

         if domain.name not in self.domains:
             raise ExtensionError('domain %s not yet registered' % domain.name)
         if not issubclass(domain, self.domains[domain.name]):
-            raise ExtensionError('new domain not a subclass of registered '
+            raise ExtensionError('new domain not a subclass of registered %s '
                                  'domain' % domain.name)
         self.domains[domain.name] = domain
 

File tests/test_application.py

 from StringIO import StringIO
 
 from sphinx.application import ExtensionError
+from sphinx.domains import Domain
 
 from util import *
 
         assert warnings.getvalue().startswith("WARNING: extension 'shutil'")
     finally:
         app.cleanup()
+
+def test_domain_override():
+    class A(Domain):
+        name = 'foo'
+    class B(A):
+        name = 'foo'
+    class C(Domain):
+        name = 'foo'
+    status, warnings = StringIO(), StringIO()
+    app = TestApp(status=status, warning=warnings)
+    try:
+        # No domain know named foo.
+        raises_msg(ExtensionError, 'domain foo not yet registered',
+                   app.override_domain, A)
+        assert app.add_domain(A) is None
+        assert app.override_domain(B) is None
+        raises_msg(ExtensionError, 'new domain not a subclass of registered '
+                   'foo domain', app.override_domain, C)
+    finally:
+        app.cleanup()