mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 15:21:41 +01:00
python: Add a Mock class to the sphinx config that can be used to mock modules
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
This commit is contained in:
parent
d2ef4edc54
commit
8c5be7d12d
1 changed files with 17 additions and 0 deletions
|
@ -18,6 +18,23 @@ import sys, os
|
|||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
sys.path.insert(0,os.path.abspath('../..'))
|
||||
|
||||
class Mock(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return Mock()
|
||||
|
||||
@classmethod
|
||||
def __getattr__(self, name):
|
||||
return Mock() if name not in ('__file__', '__path__') else '/dev/null'
|
||||
|
||||
MOCK_MODULES = [
|
||||
]
|
||||
for mod_name in MOCK_MODULES:
|
||||
sys.modules[mod_name] = Mock()
|
||||
|
||||
|
||||
from notmuch import __VERSION__,__AUTHOR__
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue