Skip to content

Commit

Permalink
First attempt at adding mock modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jemrobinson committed Jul 1, 2018
1 parent b1ef717 commit 2c143c4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import os
import sys
from mock import Mock as MagicMock

# -- Path setup --------------------------------------------------------------

# 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.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))


Expand All @@ -31,6 +32,17 @@

# -- General configuration ---------------------------------------------------

# Add a mock modules
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()

MOCK_MODULES = ["ROOT", "numpy"]
#["Double", "TF1", "TFile", "TGraph", "TGraphAsymmErrors", "TGraphErrors", "TH1", "TH2", "TObject"]
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)


# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
Expand Down

0 comments on commit 2c143c4

Please sign in to comment.