Skip to content

Commit

Permalink
Mock grpcio when generating docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
daspecster committed Jun 16, 2016
1 parent 488b600 commit 9ee7ff2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# serve to show the default.

from email import message_from_string
import mock
import os
from pkg_resources import get_distribution
import sys
Expand All @@ -23,6 +24,20 @@
ON_READ_THE_DOCS = os.environ.get('READTHEDOCS', None) == 'True'
LOCAL_READ_THE_DOCS = os.environ.get('LOCAL_RTD', None) == 'True'


# See
# (https://read-the-docs.readthedocs.io/en/latest/faq.html#\
# i-get-import-errors-on-libraries-that-depend-on-c-modules)

class Mock(mock.Mock):

@classmethod
def __getattr__(cls, name):
return Mock()


MOCK_MODULES = ('grpcio')

# 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.
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ commands =
sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html
python {toxinidir}/scripts/verify_included_modules.py
deps =
mock
Sphinx
sphinx_rtd_theme
passenv = {[testenv:system-tests]passenv} SPHINX_RELEASE READTHEDOCS LOCAL_RTD
Expand Down

0 comments on commit 9ee7ff2

Please sign in to comment.