Avoid mocking many third-party packages when building documentation

This commit is contained in:
Paul Romano 2020-11-09 14:33:29 -06:00
parent d7aaf003bb
commit d276fb590d
2 changed files with 7 additions and 10 deletions

View file

@ -3,3 +3,9 @@ jupyter
sphinxcontrib-katex
sphinxcontrib-svg2pdfconverter
nbsphinx
numpy
scipy
h5py
pandas
uncertainties
matplotlib

View file

@ -21,19 +21,10 @@ on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
from unittest.mock import MagicMock
MOCK_MODULES = [
'numpy', 'numpy.polynomial', 'numpy.polynomial.polynomial',
'numpy.ctypeslib', 'scipy', 'scipy.sparse', 'scipy.sparse.linalg',
'scipy.interpolate', 'scipy.integrate', 'scipy.optimize', 'scipy.signal',
'scipy.special', 'scipy.stats', 'scipy.spatial', 'h5py', 'pandas',
'uncertainties', 'matplotlib', 'matplotlib.pyplot', 'openmoc',
'openmc.data.reconstruct', 'openmc.checkvalue'
'openmoc', 'openmc.data.reconstruct',
]
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)
import numpy as np
np.ndarray = MagicMock
np.polynomial.Polynomial = 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