From 31e5399a6ba7de638e429a983437a4b82b26d102 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Tue, 3 Nov 2015 13:31:05 +0000 Subject: [PATCH] Testing mock modules. --- docs/source/conf.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index e381c25b..62d74cbd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,6 +20,17 @@ import os, re, shlex, sys # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('../..')) +from unittest.mock import MagicMock + +class Mock(MagicMock): + @classmethod + def __getattr__(cls, name): + return Mock() + +MOCK_MODULES = ['h5py', 'matplotlib'] +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.