Testing Mocking for read the docs.

Thu, 07 Dec 2017 17:54:46 +0200

author
Iannis <i.binietoglou@impworks.gr>
date
Thu, 07 Dec 2017 17:54:46 +0200
changeset 98
aacf4fcdd4dd
parent 97
07ff83e2990f
child 99
7f307b98889b

Testing Mocking for read the docs.

docs/conf.py file | annotate | diff | comparison | revisions
--- a/docs/conf.py	Thu Dec 07 17:51:06 2017 +0200
+++ b/docs/conf.py	Thu Dec 07 17:54:46 2017 +0200
@@ -21,6 +21,20 @@
 sys.path.insert(0, os.path.abspath('../'))
 
 
+# Mock modules for read the docs
+on_rtd = os.environ.get('READTHEDOCS') == 'True'
+
+if on_rtd:
+    from mock import Mock as MagicMock
+
+    class Mock(MagicMock):
+        @classmethod
+        def __getattr__(cls, name):
+                return MagicMock()
+
+    MOCK_MODULES = ['netCDF4', 'numpy', 'scipy',]
+    sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
+
 # -- General configuration ------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.

mercurial