mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #9655: autodoc: mocked object having doc comment is warned unexpectedly
A warning for mocked object should not be emitted if it has doc comment.
This commit is contained in:
parent
3774c124f8
commit
bdc2112dbc
1
CHANGES
1
CHANGES
@ -21,6 +21,7 @@ Bugs fixed
|
|||||||
* #9630: autodoc: Failed to build cross references if :confval:`primary_domain`
|
* #9630: autodoc: Failed to build cross references if :confval:`primary_domain`
|
||||||
is not 'py'
|
is not 'py'
|
||||||
* #9644: autodoc: Crashed on getting source info from problematic object
|
* #9644: autodoc: Crashed on getting source info from problematic object
|
||||||
|
* #9655: autodoc: mocked object having doc comment is warned unexpectedly
|
||||||
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
|
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
|
||||||
is not 'py'
|
is not 'py'
|
||||||
|
|
||||||
|
@ -913,10 +913,6 @@ class Documenter:
|
|||||||
if not self.import_object():
|
if not self.import_object():
|
||||||
return
|
return
|
||||||
|
|
||||||
if ismock(self.object):
|
|
||||||
logger.warning(__('A mocked object is detected: %r'),
|
|
||||||
self.name, type='autodoc')
|
|
||||||
|
|
||||||
# If there is no real module defined, figure out which to use.
|
# If there is no real module defined, figure out which to use.
|
||||||
# The real module is used in the module analyzer to look up the module
|
# The real module is used in the module analyzer to look up the module
|
||||||
# where the attribute documentation would actually be found in.
|
# where the attribute documentation would actually be found in.
|
||||||
@ -949,6 +945,11 @@ class Documenter:
|
|||||||
except PycodeError:
|
except PycodeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
docstrings: List[str] = sum(self.get_doc() or [], [])
|
||||||
|
if ismock(self.object) and not docstrings:
|
||||||
|
logger.warning(__('A mocked object is detected: %r'),
|
||||||
|
self.name, type='autodoc')
|
||||||
|
|
||||||
# check __module__ of object (for members not given explicitly)
|
# check __module__ of object (for members not given explicitly)
|
||||||
if check_module:
|
if check_module:
|
||||||
if not self.check_module():
|
if not self.check_module():
|
||||||
|
Loading…
Reference in New Issue
Block a user