add more extendable options and tests

This commit is contained in:
pbudzyns 2021-01-25 13:15:13 +01:00
parent 0a85b4148e
commit 7348ba8d60
2 changed files with 6 additions and 1 deletions

View File

@ -87,7 +87,8 @@ def process_documenter_options(documenter: "Type[Documenter]", config: Config, o
negated = options.pop('no-' + name, True) is None negated = options.pop('no-' + name, True) is None
if name in config.autodoc_default_options and not negated: if name in config.autodoc_default_options and not negated:
if name in options: if name in options:
# take value from options if present or extend it with autodoc_default_options if necessary # take value from options if present or extend it
# with autodoc_default_options if necessary
if name in AUTODOC_EXTENDABLE_OPTIONS: if name in AUTODOC_EXTENDABLE_OPTIONS:
if options[name] is not None and options[name].startswith('+'): if options[name] is not None and options[name].startswith('+'):
options[name] = ','.join([config.autodoc_default_options[name], options[name] = ','.join([config.autodoc_default_options[name],

View File

@ -835,6 +835,10 @@ def test_autodoc_special_members(app):
' .. py:method:: Class.undocmeth()' ' .. py:method:: Class.undocmeth()'
] ]
@pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_autodoc_special_members_extentiable(app):
# specific special methods from autodoc_default_options # specific special methods from autodoc_default_options
options = {"undoc-members": None} options = {"undoc-members": None}
app.config.autodoc_default_options["special-members"] = "__special2__" app.config.autodoc_default_options["special-members"] = "__special2__"