python: Add a Mock class to the sphinx config that can be used to mock modules
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Fri, 10 Feb 2012 17:52:19 +0000 (18:52 +0100)
committerJustus Winter <4winter@informatik.uni-hamburg.de>
Fri, 10 Feb 2012 17:54:49 +0000 (18:54 +0100)
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
bindings/python/docs/source/conf.py

index e0ee39cdea9a891da0077ebf53992b5df13a2ae1..c7b951859b84116daffac2888422a52488c32716 100644 (file)
@@ -18,6 +18,23 @@ import sys, os
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.insert(0,os.path.abspath('../..'))
 
+class Mock(object):
+    def __init__(self, *args, **kwargs):
+        pass
+
+    def __call__(self, *args, **kwargs):
+        return Mock()
+
+    @classmethod
+    def __getattr__(self, name):
+        return Mock() if name not in ('__file__', '__path__') else '/dev/null'
+
+MOCK_MODULES = [
+]
+for mod_name in MOCK_MODULES:
+    sys.modules[mod_name] = Mock()
+
+
 from notmuch import __VERSION__,__AUTHOR__
 # -- General configuration -----------------------------------------------------