Fix #9866: autodoc: doccoment for the imported class was ignored

Autodoc tried to scan doccomment on the module where the class defined.
But it failed to get it if the class is imported from other module.

This analyzes the target module to obtain the doccomment.
This commit is contained in:
Takeshi KOMIYA
2021-11-21 11:25:48 +09:00
parent 647314133d
commit fb92547b91
5 changed files with 30 additions and 3 deletions

View File

@@ -407,6 +407,18 @@ def test_class_alias_having_doccomment(app):
]
def test_class_alias_for_imported_object_having_doccomment(app):
actual = do_autodoc(app, 'class', 'target.classes.IntAlias')
assert list(actual) == [
'',
'.. py:attribute:: IntAlias',
' :module: target.classes',
'',
' docstring',
'',
]
@pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_coroutine(app):
options = {"members": None}