Skip to content

Commit

Permalink
add mock imports so docs will build on RTD
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandersax committed May 2, 2018
1 parent 1af367f commit a45f133
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
17 changes: 14 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,21 @@
sys.path.insert(0, os.path.abspath('../torchnet'))
sys.path.insert(0, os.path.abspath('..'))

from unittest.mock import MagicMock


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

MOCK_MODULES = ['numpy', 'torch', 'torch.utils', 'torch.utils.data', 'visdom']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

import torchnet
from sphinx.util import logging
logger = logging.getLogger(__name__)
logger.info("Loading successful {}".format(torchnet))
# from sphinx.util import logging
# logger = logging.getLogger(__name__)
# logger.info("Loading successful {}".format(torchnet))


# -- Project information -----------------------------------------------------
Expand Down
5 changes: 1 addition & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
sphinx
-e git://github.com/snide/sphinx_rtd_theme.git#egg=sphinx_rtd_theme
torch
numpy
visdom
sphinx_rtd_theme

0 comments on commit a45f133

Please sign in to comment.