Skip to content

Commit

Permalink
docs(readthedocs): Fix builds on yamllint.readthedocs.io
Browse files Browse the repository at this point in the history
Documentation builds on readthedocs.io partly fail because some modules
imported by yammlint cannot be imported in Sphinx automodule.

This commit fixes that using the tip at [1].

Closes #66

[1]: http://docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
  • Loading branch information
adrienverge committed Sep 3, 2017
1 parent db57127 commit 59bdbf1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import sys
import os
from unittest.mock import MagicMock

sys.path.insert(0, os.path.abspath('..')) # noqa

Expand Down Expand Up @@ -40,3 +41,14 @@
man_pages = [
('index', 'yamllint', '', [u'Adrien Vergé'], 1)
]

# -- Build with sphinx automodule without needing to install third-party libs


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

MOCK_MODULES = ['pathspec', 'yaml']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

0 comments on commit 59bdbf1

Please sign in to comment.