-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Milestone
Description
Describe the bug
When a class inherits another class from a mocked import as defined in autodoc_mock_imports, the docstring is skipped by autodoc when building documentation.
To Reproduce
Example project taken from #4965
Project module foo.py:
import bar
class FooClass(bar.BarClass):
"""This is myclass"""
pass
conf.py:
import sys
import os
autodoc_mock_imports = ['bar']
sys.path.insert(0, os.path.abspath('.'))
extensions = [
'sphinx.ext.autodoc',
]
contents.rst:
foo
===
.. automodule:: foo
:members:
:undoc-members:
:show-inheritance:
Build Command
$ sphinx-apidoc -f -o docs/ .
$ sphinx-build -b html docs/ docs/build/html -E -a
Expected behavior
The built documentation would include the foo.FooClass class and its docstring.
Your project
mocked_import_issue.zip
Environment info
- OS: Linux
- Python version: 3.8.5
- Sphinx version: 3.2.1
- Sphinx extensions: sphinx.ext.autodoc
- Extra tools:
Additional context
Sphinx 3.0.1 build correctly, later versions skip the foo.FooClass when building documentation.
Reactions are currently unavailable