summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2012-01-05 16:59:23 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2012-01-05 16:59:23 +0100
commit022edcff715856024c116e3b2a059fb0517cded9 (patch)
treeb3737459fbf4c40be6216287a18f4a1153092d88 /docs
parentd4922e95450cf4587d58d9eb3abee1e8c768d2fd (diff)
Improve the Mock class
The python import machinery expects __path__ to be a string, so __getattr__ has to return a mock string instead of a mock object. __getattr__ now also returns Mock objects instead of the Mock class and Mock objects are now callable. Fixes #228.
Diffstat (limited to 'docs')
-rw-r--r--docs/conf.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 0486700a..0c36a73f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -22,8 +22,12 @@ 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 != '__file__' else '/dev/null'
+ return Mock() if name not in ('__file__', '__path__') else '/dev/null'
MOCK_MODULES = ['notmuch', 'notmuch.globals',
'twisted', 'twisted.internet',