Add pyldap mock for readthedocs (#912)

This commit is contained in:
Francisco Santos 2017-09-11 18:18:03 +02:00 committed by kevgliss
parent 7106c4fdcf
commit 2ecfaa41cf
2 changed files with 13 additions and 1 deletions

View File

@ -13,12 +13,24 @@
# serve to show the default.
import sys
import os
from unittest.mock import MagicMock
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
# Mock packages that cannot be installed on rtd
on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()
MOCK_MODULES = ['ldap']
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.

View File

@ -28,7 +28,7 @@ tabulate==0.7.7
pem==17.1.0
raven[flask]==6.1.0
jinja2==2.9.6
pyldap==2.4.37 # required by ldap auth provider
# pyldap==2.4.37 # cannot be installed on rtd - required by ldap auth provider
paramiko==2.2.1 # required for lemur_linuxdst plugin
sphinx
sphinxcontrib-httpdomain