Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -24,6 +24,8 @@ Bugs fixed
----------

* #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
command before showing help

Expand Down
6 changes: 5 additions & 1 deletion doc/usage/extensions/autodoc.rst
Expand Up @@ -528,7 +528,8 @@ There are also config values that you can set:
The supported options are ``'members'``, ``'member-order'``,
``'undoc-members'``, ``'private-members'``, ``'special-members'``,
``'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

Expand All @@ -541,6 +542,9 @@ There are also config values that you can set:
.. versionchanged:: 4.1
Added ``'class-doc-from'``.

.. versionchanged:: 4.5
Added ``'class-doc-from'``.
tk0miya marked this conversation as resolved.
Show resolved Hide resolved

.. confval:: autodoc_docstring_signature

Functions imported from C modules cannot be introspected, and therefore the
Expand Down
3 changes: 2 additions & 1 deletion sphinx/ext/autodoc/__init__.py
Expand Up @@ -1001,7 +1001,8 @@ class ModuleDocumenter(Documenter):
'platform': identity, 'deprecated': bool_option,
'member-order': member_order_option, 'exclude-members': exclude_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:
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/autodoc/directive.py
Expand Up @@ -30,7 +30,7 @@
AUTODOC_DEFAULT_OPTIONS = ['members', 'undoc-members', 'inherited-members',
'show-inheritance', 'private-members', 'special-members',
'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',
'exclude-members']
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ext_autodoc_autoattribute.py
Expand Up @@ -32,7 +32,7 @@ def test_autoattribute(app):

@pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_autoattribute_novalue(app):
options = {'no-value': True}
options = {'no-value': None}
actual = do_autodoc(app, 'attribute', 'target.Class.attr', options)
assert list(actual) == [
'',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ext_autodoc_autodata.py
Expand Up @@ -32,7 +32,7 @@ def test_autodata(app):

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