Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
Fix doc build issue with ExtractAs
Browse files Browse the repository at this point in the history
RTD build was failing due to problems with the
`ExtractAs` class.  Now mocking it.  Possibly
a newer version of Sphinx has pointed out this
old problem.

Added a note on how to do a local doc build
using a Docker container.
  • Loading branch information
ajoubertza committed Dec 23, 2020
1 parent 2203f49 commit 31a8d9e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion doc/how-to-contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ It also uses autodoc_ importing docstrings from tango package.
Theme is not important, a theme prepared for Tango Community can be also used.

To test the docs locally requires Python >= 3.5:
- ``$ pip install sphinx sphinx_rtd_theme``
- ``$ python -m pip install sphinx sphinx_rtd_theme``
- ``$ python setup.py build_doc``

To test the docs locally in a Sphinx Docker container:
- ``(host) $ cd /path/to/pytango``
- ``(host) $ docker run --rm -ti -v $PWD:/docs sphinxdoc/sphinx bash``
- ``(container) $ python -m pip install six numpy sphinx_rtd_theme``
- ``(container) $ python -m sphinx doc build/sphinx``

After building, open the ``build/doc/index.html`` page in your browser.

Source code standard
--------------------

Expand Down
16 changes: 16 additions & 0 deletions doc/mock_tango_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,28 @@ def set_device_proxy_implementations(module):
module.DeviceProxy = type('DeviceProxy', (module.Connection,), attrs)


# Create ExtractAs with dummy "methods"
def set_extract_as_implementation(module):
attrs= {
'__module__': module.__name__,
'ByteArray': None,
'Bytes': None,
'List': None,
'Nothing': None,
'Numpy': None,
'String': None,
'Tuple': None,
}
module.ExtractAs = type('ExtractAs', (object,), attrs)


# Patch the extension module
_tango = ExtensionMock(name='_tango')
_tango.constants.TgLibVers = TANGO_VERSION
_tango._get_tango_lib_release.return_value = TANGO_VERSION_INT
set_device_implementations(_tango)
set_device_proxy_implementations(_tango)
set_extract_as_implementation(_tango)


# Patch modules
Expand Down

0 comments on commit 31a8d9e

Please sign in to comment.