You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/04/16 04:48:06 UTC

git commit: Use custom Mock since mock lib not available

Updated Branches:
  refs/heads/tv/docs 39c6ff2e5 -> 60ef50c34


Use custom Mock since mock lib not available

Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/60ef50c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/60ef50c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/60ef50c3

Branch: refs/heads/tv/docs
Commit: 60ef50c34bbd021d8bbbe3ea98c6dc1cea6a5a27
Parents: 39c6ff2
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Apr 16 02:47:46 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Apr 16 02:47:46 2013 +0000

----------------------------------------------------------------------
 Allura/docs/conf.py |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/60ef50c3/Allura/docs/conf.py
----------------------------------------------------------------------
diff --git a/Allura/docs/conf.py b/Allura/docs/conf.py
index 4785577..f18e11b 100644
--- a/Allura/docs/conf.py
+++ b/Allura/docs/conf.py
@@ -12,14 +12,31 @@
 # serve to show the default.
 
 import sys, os
-import mock
+
+class Mock(object):
+    def __init__(self, *args, **kwargs):
+        pass
+
+    def __call__(self, *args, **kwargs):
+        return Mock()
+
+    @classmethod
+    def __getattr__(cls, name):
+        if name in ('__file__', '__path__'):
+            return '/dev/null'
+        elif name[0] == name[0].upper():
+            mockType = type(name, (), {})
+            mockType.__module__ = __name__
+            return mockType
+        else:
+            return Mock()
 
 MOCK_MODULES = ['matplotlib', 'matplotlib.axes',
         'matplotlib.backends', 'matplotlib.backends.backend_agg',
         'matplotlib.figure', 'matplotlib.patches']
 
 for mod_name in MOCK_MODULES:
-    sys.modules[mod_name] = mock.Mock()
+    sys.modules[mod_name] = Mock()
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the