mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6508 from tk0miya/refactor_autosummary3
Fix #6507: autosummary: crashes without no autosummary_generate setting
This commit is contained in:
commit
64ca455c23
1
CHANGES
1
CHANGES
@ -42,6 +42,7 @@ Bugs fixed
|
|||||||
* #6439: Make generated download links reproducible
|
* #6439: Make generated download links reproducible
|
||||||
* #6486: UnboundLocalError is raised if broken extension installed
|
* #6486: UnboundLocalError is raised if broken extension installed
|
||||||
* #6498: autosummary: crashed with wrong autosummary_generate setting
|
* #6498: autosummary: crashed with wrong autosummary_generate setting
|
||||||
|
* #6507: autosummary: crashes without no autosummary_generate setting
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -257,12 +257,19 @@ class Autosummary(SphinxDirective):
|
|||||||
docname = posixpath.join(tree_prefix, real_name)
|
docname = posixpath.join(tree_prefix, real_name)
|
||||||
docname = posixpath.normpath(posixpath.join(dirname, docname))
|
docname = posixpath.normpath(posixpath.join(dirname, docname))
|
||||||
if docname not in self.env.found_docs:
|
if docname not in self.env.found_docs:
|
||||||
|
location = self.state_machine.get_source_and_line(self.lineno)
|
||||||
if excluded(self.env.doc2path(docname, None)):
|
if excluded(self.env.doc2path(docname, None)):
|
||||||
logger.warning(__('toctree references excluded document %r'), docname)
|
msg = __('autosummary references excluded document %r. Ignored.')
|
||||||
else:
|
else:
|
||||||
logger.warning(__('toctree references unknown document %r'), docname)
|
msg = __('autosummary: stub file not found %r. '
|
||||||
|
'Check your autosummary_generate setting.')
|
||||||
|
|
||||||
|
logger.warning(msg, real_name, location=location)
|
||||||
|
continue
|
||||||
|
|
||||||
docnames.append(docname)
|
docnames.append(docname)
|
||||||
|
|
||||||
|
if docnames:
|
||||||
tocnode = addnodes.toctree()
|
tocnode = addnodes.toctree()
|
||||||
tocnode['includefiles'] = docnames
|
tocnode['includefiles'] = docnames
|
||||||
tocnode['entries'] = [(None, docn) for docn in docnames]
|
tocnode['entries'] = [(None, docn) for docn in docnames]
|
||||||
|
@ -304,6 +304,14 @@ def test_generate_autosummary_docs_property(app):
|
|||||||
".. autoproperty:: Base.prop")
|
".. autoproperty:: Base.prop")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('dummy', testroot='ext-autosummary',
|
||||||
|
confoverrides={'autosummary_generate': []})
|
||||||
|
def test_empty_autosummary_generate(app, status, warning):
|
||||||
|
app.build()
|
||||||
|
assert ("WARNING: autosummary: stub file not found 'autosummary_importfail'"
|
||||||
|
in warning.getvalue())
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('dummy', testroot='ext-autosummary',
|
@pytest.mark.sphinx('dummy', testroot='ext-autosummary',
|
||||||
confoverrides={'autosummary_generate': ['unknown']})
|
confoverrides={'autosummary_generate': ['unknown']})
|
||||||
def test_invalid_autosummary_generate(app, status, warning):
|
def test_invalid_autosummary_generate(app, status, warning):
|
||||||
|
Loading…
Reference in New Issue
Block a user