Commits

Miran Levar  committed 7b2ee79

Possible rtd fix

  • Participants
  • Parent commits 3307bec

Comments (0)

Files changed (2)

File docs/rst/conf.py

 # serve to show the default.
 
 import sys, os
-import mock
+
 import imp
-
 module_setup = imp.load_source('module_setup', os.path.join(os.path.dirname(__file__), '..', '..', 'setup.py'))
 VERSION = module_setup.VERSION
 AUTHOR = module_setup.AUTHOR
 
 TITLE = "%s v%s documentation" % (DOCUMENTATION_NAME, VERSION)
 
+# Possible fix for rtd documentation
+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():
+            return type(name, (), {})
+        else:
+            return Mock()
+
 MOCK_MODULES = ['numpy', 'linalg', 'numpy.linalg', 'numpy.distutils.core', 'distutils', 'core', 'scipy', 'scipy.sparse', 'scipy.optimize']
 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,

File rdt_requirements

-mock
 -e hg+https://bitbucket.org/biolab/orange/#egg=Orange