Fix #9479: autodoc: Emit a warning if target is a mocked object

This commit is contained in:
Takeshi KOMIYA 2021-07-27 23:55:26 +09:00
parent f59026865a
commit a7daa19a93
2 changed files with 5 additions and 0 deletions

View File

@ -14,6 +14,7 @@ Features added
--------------
* #9445: autodoc: Support class properties
* #9479: autodoc: Emit a warning if target is a mocked object
* #9445: py domain: ``:py:property:`` directive supports ``:classmethod:``
option to describe the class property

View File

@ -913,6 +913,10 @@ class Documenter:
if not self.import_object():
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.
# The real module is used in the module analyzer to look up the module
# where the attribute documentation would actually be found in.