incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [49/50] [abbrv] git commit: Use custom Mock since mock lib not available
Date Wed, 24 Apr 2013 04:54:54 GMT
Use custom Mock since mock lib not available

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@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/885da78d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/885da78d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/885da78d

Branch: refs/heads/tv/docs
Commit: 885da78d598ada233cf6decadddaabe4735c4a08
Parents: c542db2
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Tue Apr 16 02:47:46 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Apr 23 23:39:22 2013 -0400

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/885da78d/Allura/docs/conf.py
----------------------------------------------------------------------
diff --git a/Allura/docs/conf.py b/Allura/docs/conf.py
index 5f2d6cb..81c0e1f 100644
--- a/Allura/docs/conf.py
+++ b/Allura/docs/conf.py
@@ -29,14 +29,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


Mime
View raw message