mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6289 from alsrgv/add_imported_members_directive
Add imported-members to the directive whitelist
This commit is contained in:
commit
cc7a81419f
@ -387,14 +387,17 @@ 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'`` and
|
``'inherited-members'``, ``'show-inheritance'``, ``'ignore-module-all'``,
|
||||||
``'exclude-members'``.
|
``'imported-members'`` and ``'exclude-members'``.
|
||||||
|
|
||||||
.. versionadded:: 1.8
|
.. versionadded:: 1.8
|
||||||
|
|
||||||
.. versionchanged:: 2.0
|
.. versionchanged:: 2.0
|
||||||
Accepts ``True`` as a value.
|
Accepts ``True`` as a value.
|
||||||
|
|
||||||
|
.. versionchanged:: 2.1
|
||||||
|
Added ``'imported-members'``.
|
||||||
|
|
||||||
.. 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
|
||||||
|
@ -30,7 +30,8 @@ logger = logging.getLogger(__name__)
|
|||||||
# common option names for autodoc directives
|
# common option names for autodoc directives
|
||||||
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 DummyOptionSpec(dict):
|
class DummyOptionSpec(dict):
|
||||||
|
@ -1581,6 +1581,8 @@ def test_autodoc_default_options(app):
|
|||||||
assert ' .. py:attribute:: EnumCls.val4' not in actual
|
assert ' .. py:attribute:: EnumCls.val4' not in actual
|
||||||
actual = do_autodoc(app, 'class', 'target.CustomIter')
|
actual = do_autodoc(app, 'class', 'target.CustomIter')
|
||||||
assert ' .. py:method:: target.CustomIter' not in actual
|
assert ' .. py:method:: target.CustomIter' not in actual
|
||||||
|
actual = do_autodoc(app, 'module', 'target')
|
||||||
|
assert '.. py:function:: save_traceback(app)' not in actual
|
||||||
|
|
||||||
# with :members:
|
# with :members:
|
||||||
app.config.autodoc_default_options = {'members': None}
|
app.config.autodoc_default_options = {'members': None}
|
||||||
@ -1644,6 +1646,15 @@ def test_autodoc_default_options(app):
|
|||||||
assert ' .. py:method:: CustomIter.snafucate()' in actual
|
assert ' .. py:method:: CustomIter.snafucate()' in actual
|
||||||
assert ' Makes this snafucated.' in actual
|
assert ' Makes this snafucated.' in actual
|
||||||
|
|
||||||
|
# with :imported-members:
|
||||||
|
app.config.autodoc_default_options = {
|
||||||
|
'members': None,
|
||||||
|
'imported-members': None,
|
||||||
|
'ignore-module-all': None,
|
||||||
|
}
|
||||||
|
actual = do_autodoc(app, 'module', 'target')
|
||||||
|
assert '.. py:function:: save_traceback(app)' in actual
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||||
def test_autodoc_default_options_with_values(app):
|
def test_autodoc_default_options_with_values(app):
|
||||||
|
Loading…
Reference in New Issue
Block a user