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

Fix #10058: Autosummary excludes stuff from its table if autodoc_class_signature='separated'. #10060

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion sphinx/ext/autosummary/__init__.py
Expand Up @@ -256,8 +256,9 @@ class Autosummary(SphinxDirective):
}

def run(self) -> List[Node]:
opts = Options({'imported-members': self.env.app.config.autosummary_imported_members})
self.bridge = DocumenterBridge(self.env, self.state.document.reporter,
Options(), self.lineno, self.state)
opts, self.lineno, self.state)

names = [x.strip().split()[0] for x in self.content
if x.strip() and re.search(r'^[~a-zA-Z_]', x.strip()[0])]
Expand Down
3 changes: 3 additions & 0 deletions tests/roots/test-ext-autosummary-imported_members/conf.py
Expand Up @@ -6,3 +6,6 @@
extensions = ['sphinx.ext.autosummary']
autosummary_generate = True
autosummary_imported_members = True

# test for #10058 - shoud be scoped just to test_autosummary_imported_members_table_10058
autodoc_class_signature = 'separated'
7 changes: 7 additions & 0 deletions tests/roots/test-ext-autosummary-imported_members/index.rst
Expand Up @@ -5,3 +5,10 @@ test-ext-autosummary-mock_imports
:toctree: generated

autosummary_dummy_package

.. currentmodule:: autosummary_dummy_package

.. autosummary::

foo
Bar
44 changes: 44 additions & 0 deletions tests/test_ext_autosummary.py
Expand Up @@ -535,6 +535,50 @@ def test_autosummary_imported_members(app, status, warning):
finally:
sys.modules.pop('autosummary_dummy_package', None)

@pytest.mark.sphinx('dummy', testroot='ext-autosummary-imported_members')
def test_autosummary_imported_members_table_10058(app, status, warning):
try:
#app.env.config.autodoc_class_signature = 'separated'
app.build()

doctree = app.env.get_doctree('index')

assert_node(doctree, (nodes.section,))
# nodes.paragraph,
# addnodes.tabular_col_spec,
# autosummary_table,
# [autosummary_toc, addnodes.toctree]))
assert_node(doctree[0], (
nodes.title,
addnodes.tabular_col_spec,
autosummary_table,
autosummary_toc,
addnodes.tabular_col_spec,
autosummary_table
))

table = list(doctree[0].traverse(autosummary_table))[1]

assert_node(table, [
autosummary_table,
nodes.table,
nodes.tgroup,
(nodes.colspec, nodes.colspec, nodes.tbody)
])

tbody = table.next_node(nodes.tbody)

assert_node(tbody, (
[nodes.row, (nodes.entry, nodes.entry)],
[nodes.row, (nodes.entry, nodes.entry)]
))

assert 'foo' in tbody[0][0].next_node(nodes.Text).astext()
assert 'Bar' in tbody[1][0].next_node(nodes.Text).astext()

finally:
sys.modules.pop('autosummary_dummy_package', None)


@pytest.mark.sphinx(testroot='ext-autodoc',
confoverrides={'extensions': ['sphinx.ext.autosummary']})
Expand Down