Skip to content

Commit

Permalink
sphinx-doc#10058 - add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarrad Whitaker committed Jan 7, 2022
1 parent 6402acd commit 1d58dcc
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
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

0 comments on commit 1d58dcc

Please sign in to comment.