Close #10146: autodoc: autodoc_default_options does not support no-value option

This commit is contained in:
Takeshi KOMIYA 2022-01-31 01:38:12 +09:00
parent 799385f555
commit b0b51cecc2
6 changed files with 12 additions and 5 deletions

View File

@ -24,6 +24,8 @@ Bugs fixed
---------- ----------
* #10133: autodoc: Crashed when mocked module is used for type annotation * #10133: autodoc: Crashed when mocked module is used for type annotation
* #10146: autodoc: :confval:`autodoc_default_options` does not support
``no-value`` option
* #10122: sphinx-build: make.bat does not check the installation of sphinx-build * #10122: sphinx-build: make.bat does not check the installation of sphinx-build
command before showing help command before showing help

View File

@ -528,7 +528,8 @@ There are also config values that you can set:
The supported options are ``'members'``, ``'member-order'``, The supported options are ``'members'``, ``'member-order'``,
``'undoc-members'``, ``'private-members'``, ``'special-members'``, ``'undoc-members'``, ``'private-members'``, ``'special-members'``,
``'inherited-members'``, ``'show-inheritance'``, ``'ignore-module-all'``, ``'inherited-members'``, ``'show-inheritance'``, ``'ignore-module-all'``,
``'imported-members'``, ``'exclude-members'`` and ``'class-doc-from'``. ``'imported-members'``, ``'exclude-members'``, ``'class-doc-from'`` and
``'no-value'``.
.. versionadded:: 1.8 .. versionadded:: 1.8
@ -541,6 +542,9 @@ There are also config values that you can set:
.. versionchanged:: 4.1 .. versionchanged:: 4.1
Added ``'class-doc-from'``. Added ``'class-doc-from'``.
.. versionchanged:: 4.5
Added ``'class-doc-from'``.
.. confval:: autodoc_docstring_signature .. confval:: autodoc_docstring_signature
Functions imported from C modules cannot be introspected, and therefore the Functions imported from C modules cannot be introspected, and therefore the

View File

@ -1001,7 +1001,8 @@ class ModuleDocumenter(Documenter):
'platform': identity, 'deprecated': bool_option, 'platform': identity, 'deprecated': bool_option,
'member-order': member_order_option, 'exclude-members': exclude_members_option, 'member-order': member_order_option, 'exclude-members': exclude_members_option,
'private-members': members_option, 'special-members': members_option, 'private-members': members_option, 'special-members': members_option,
'imported-members': bool_option, 'ignore-module-all': bool_option 'imported-members': bool_option, 'ignore-module-all': bool_option,
'no-value': bool_option,
} }
def __init__(self, *args: Any) -> None: def __init__(self, *args: Any) -> None:

View File

@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
AUTODOC_DEFAULT_OPTIONS = ['members', 'undoc-members', 'inherited-members', AUTODOC_DEFAULT_OPTIONS = ['members', 'undoc-members', 'inherited-members',
'show-inheritance', 'private-members', 'special-members', 'show-inheritance', 'private-members', 'special-members',
'ignore-module-all', 'exclude-members', 'member-order', 'ignore-module-all', 'exclude-members', 'member-order',
'imported-members', 'class-doc-from'] 'imported-members', 'class-doc-from', 'no-value']
AUTODOC_EXTENDABLE_OPTIONS = ['members', 'private-members', 'special-members', AUTODOC_EXTENDABLE_OPTIONS = ['members', 'private-members', 'special-members',
'exclude-members'] 'exclude-members']

View File

@ -32,7 +32,7 @@ def test_autoattribute(app):
@pytest.mark.sphinx('html', testroot='ext-autodoc') @pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_autoattribute_novalue(app): def test_autoattribute_novalue(app):
options = {'no-value': True} options = {'no-value': None}
actual = do_autodoc(app, 'attribute', 'target.Class.attr', options) actual = do_autodoc(app, 'attribute', 'target.Class.attr', options)
assert list(actual) == [ assert list(actual) == [
'', '',

View File

@ -32,7 +32,7 @@ def test_autodata(app):
@pytest.mark.sphinx('html', testroot='ext-autodoc') @pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_autodata_novalue(app): def test_autodata_novalue(app):
options = {'no-value': True} options = {'no-value': None}
actual = do_autodoc(app, 'data', 'target.integer', options) actual = do_autodoc(app, 'data', 'target.integer', options)
assert list(actual) == [ assert list(actual) == [
'', '',