Skip to content

Commit 34037aa

Browse files
Allow users to suppress autodoc.mocked_object warnings (#9732)
Co-authored-by: Adam Turner <[email protected]>
1 parent fc62472 commit 34037aa

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Features added
5050
pattern doesn't match any documents, via the new ``toc.glob_not_matching``
5151
warning sub-type.
5252
Patch by Slawek Figiel.
53+
* #9732: Add the new ``autodoc.mock_objects`` warnings sub-type.
54+
Patch by Cyril Roelandt.
5355

5456
Bugs fixed
5557
----------

doc/usage/configuration.rst

+6
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,7 @@ Options for warning control
14041404

14051405
* ``autodoc``
14061406
* ``autodoc.import_object``
1407+
* ``autodoc.mocked_object``
14071408
* ``autosectionlabel.<document name>``
14081409
* ``autosummary``
14091410
* ``autosummary.import_cycle``
@@ -1453,6 +1454,11 @@ Options for warning control
14531454
.. versionadded:: 8.2
14541455
Added ``toc.empty_glob``.
14551456

1457+
.. versionadded:: 8.2
1458+
1459+
Added ``autodoc.mocked_object``
1460+
1461+
14561462
Builder options
14571463
===============
14581464

sphinx/ext/autodoc/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,10 @@ def generate(
10321032
)
10331033
if ismock(self.object) and not docstrings:
10341034
logger.warning(
1035-
__('A mocked object is detected: %r'), self.name, type='autodoc'
1035+
__('A mocked object is detected: %r'),
1036+
self.name,
1037+
type='autodoc',
1038+
subtype='mocked_object',
10361039
)
10371040

10381041
# check __module__ of object (for members not given explicitly)

0 commit comments

Comments
 (0)