Commits

Miran Levar  committed 5b122ef

Changed to imported mock.

  • Participants
  • Parent commits ea91c38

Comments (0)

Files changed (1)

File docs/rst/conf.py

 # serve to show the default.
 
 import sys, os
+import mock
+import imp
 
-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', 'distutils', 'core', 'scipy', 'scipy.sparse', 'scipy.optimize']
+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()
+    sys.modules[mod_name] = mock.Mock()
 
 
 # If extensions (or modules to document with autodoc) are in another directory,