autodoc: make full reference for classes, aliased with "alias of"

We do this here only if class belongs to the different module.

Closes sphinx-doc/sphinx#2437
This commit is contained in:
Sergey B Kirpichev
2017-10-24 13:26:32 +03:00
parent 695b9f9e18
commit b1c100ca3b
8 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
from bug2437.autodoc_dummy_foo import Foo
class Bar(object):
"""Dummy class Bar with alias."""
my_name = Foo

View File

@@ -0,0 +1,3 @@
class Foo(object):
"""Dummy class Foo."""
pass

View File

@@ -10,3 +10,5 @@ source_suffix = '.rst'
autodoc_mock_imports = [
'dummy'
]
nitpicky = True

View File

@@ -1,3 +1,9 @@
.. automodule:: autodoc_dummy_module
:members:
.. automodule:: bug2437.autodoc_dummy_foo
:members:
.. automodule:: autodoc_dummy_bar
:members:

View File

@@ -22,3 +22,13 @@ def test_autodoc(app, status, warning):
assert isinstance(content[3], addnodes.desc)
assert content[3][0].astext() == 'autodoc_dummy_module.test'
assert content[3][1].astext() == 'Dummy function using dummy.*'
# issue sphinx-doc/sphinx#2437
assert content[11][-1].astext() == """Dummy class Bar with alias.
my_name
alias of bug2437.autodoc_dummy_foo.Foo"""
assert warning.getvalue() == ''