diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 404cc33b..35d7ecc8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,7 +16,7 @@ jobs: - name: Install dependencies run: | sudo apt install pandoc - pip install sphinx sphinx_rtd_theme nbsphinx + pip install sphinx sphinx_rtd_theme nbsphinx mock - name: Sphinx build run: | make -C docs html diff --git a/docs/conf.py b/docs/conf.py index d09af265..57a82fdb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -67,6 +67,15 @@ 'tqdm', 'scipy'] +# There seems to be a conflict between unittest.mock (used by sphinx) and metaclasses +# The cosipy.threeml.custom_functions.Band_Eflux includes a metaclass from +# astromodels.functions.function, so we mock that one manually with the mock package +import mock + +MOCK_MODULES = ['astromodels.functions.function'] +for mod_name in MOCK_MODULES: + sys.modules[mod_name] = mock.Mock() + # intersphinx for mocked dependencies intersphinx_mapping = { diff --git a/docs/install.rst b/docs/install.rst index 243ff397..73dedff6 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -31,9 +31,9 @@ You can install ``pytest`` and ``pytest-cov`` with:: Compiling the docs ------------------ -You need pandoc, sphinx, nbsphinx and sphinx_rtd_theme. Using conda:: +You need pandoc, sphinx, nbsphinx, sphinx_rtd_theme and mock. Using conda:: - conda install -c conda-forge pandoc nbsphinx sphinx_rtd_theme + conda install -c conda-forge pandoc nbsphinx sphinx_rtd_theme mock Onece you have this requirements, run::