Commit 8490d028 authored by Joel Collins's avatar Joel Collins
Browse files

Handle mock imports for non-platform-agnostic modules

parent 259ec415
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
Sphinx
sphinxcontrib-httpdomain
sphinx_rtd_theme
openflexure-stage
Pillow
pyyaml
 No newline at end of file
+19 −3
Original line number Diff line number Diff line
@@ -12,10 +12,26 @@
# 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('.'))
import os
import sys

# Load module from relative imports

module_path = os.path.abspath('../..')
sys.path.insert(0, module_path)

# Handle mock imports for non-platform-agnostic modules

from unittest.mock import MagicMock

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

mock_imports = ['picamera', 'picamera.array', 'picamera.mmalobj']

sys.modules.update((mod_name, Mock()) for mod_name in mock_imports)

# -- Project information -----------------------------------------------------