diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-08-08 20:06:46 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-11-03 02:27:43 +0900 |
commit | 0e98e9b1a8ade24acf1d91f59aa90e8b1e179b19 (patch) | |
tree | 6fdb9ca354e92e1fe28efb6fbf9fdabf45e77f15 /tests/test_domain_py.py | |
parent | 487b8436c6e8dc596db4b8d4d06e9145105a2ac2 (diff) | |
download | sphinx-git-0e98e9b1a8ade24acf1d91f59aa90e8b1e179b19.tar.gz |
Fix #6914: Emit a detailed warning when failed to resolve :ref:
To be clear the ambiguous warning for missing-reference :ref:,
this separates the warning to missing-label and missing-caption.
To emit a warning dynamically, this also adds a new event:
`warn-missing-reference` to customize warning messages via event
handlers.
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r-- | tests/test_domain_py.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index ceea51508..d81b406c2 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -859,3 +859,11 @@ def test_noindexentry(app): assert_node(doctree, (addnodes.index, desc, addnodes.index, desc)) assert_node(doctree[0], addnodes.index, entries=[('single', 'f (built-in class)', 'f', '', None)]) assert_node(doctree[2], addnodes.index, entries=[]) + + +@pytest.mark.sphinx('dummy', testroot='domain-py-xref-warning') +def test_warn_missing_reference(app, status, warning): + app.build() + assert 'index.rst:6: WARNING: undefined label: no-label' in warning.getvalue() + assert ('index.rst:6: WARNING: Failed to create a cross reference. A title or caption not found: existing-label' + in warning.getvalue()) |