# HG changeset patch # User Iannis # Date 1512662086 -7200 # Node ID aacf4fcdd4dd8373bf19a3509932e8a6d1645758 # Parent 07ff83e2990f432486fbdbc2e680900e9642fbb1 Testing Mocking for read the docs. diff -r 07ff83e2990f -r aacf4fcdd4dd docs/conf.py --- 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.