Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autodoc mock imports results in undocumented object #9883

Closed
PhilippSelenium opened this issue Nov 22, 2021 · 0 comments
Closed

autodoc mock imports results in undocumented object #9883

PhilippSelenium opened this issue Nov 22, 2021 · 0 comments

Comments

@PhilippSelenium
Copy link

PhilippSelenium commented Nov 22, 2021

Describe the bug

When mocking an import with autodoc_mock_imports objects that derive from the mocked package have no docstring. See picture below where the foo.FOO constant is not documented.

How to Reproduce

foo.py

"""Foo module."""

from asdf import qwerty

FOO = qwerty.FOO
"""Foo constant."""

ASDF = 1
"""ASDF."""

def foo():
    """Return foo :py:const:`foo.FOO` :py:const:`foo.ASDF`."""
    return FOO

conf.py

import os
import sys
sys.path.insert(0, os.path.abspath(os.pardir))

project = 'sphinx'
copyright = '2021, sphinx'
author = 'sphinx'

extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
exclude_patterns = []
html_theme = 'alabaster'
html_static_path = ['_static']

autodoc_mock_imports = ['asdf']

run:

make html SPHINXOPTS=-Ea

Expected behavior

The docstring of foo.FOO is displayed in the documentation

Your project

See How to reproduce

Screenshots

Screenshot 2021-11-19 at 09-31-04 foo module — sphinx documentation

OS

Linux

Python version

3.8.5

Sphinx version

4.3.0

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

@tk0miya tk0miya added this to the 4.4.0 milestone Nov 23, 2021
tk0miya added a commit that referenced this issue Nov 29, 2021
Fix #9883: autodoc: doccomment for the alias to mocked object was ignored
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants