sphinx/tests/test_extensions
Chris Sewell 04bd0df100
👌 Improve external role warnings (and revert object fallback) (#12193)
The key issue this commit seeks to address, is that existing tools / documentation often lead users to mistakenly use object types and not role names, a classic example being `function` not `func`

Previously, the warning message for using e.g. `` external:function`target` `` (with `py` as the default domain), would be:

```
WARNING: role for external cross-reference not found: function
```

This gives no information to the user on how to fix the issue, even though there is actually quite an easy fix

This commit adds logic to create more specific / helpful warning messages, e.g.

```
WARNING: role for external cross-reference not found in domains 'py', 'std': 'function' (perhaps you meant one of: 'py:func', 'py:obj')
```

This goes through the same original logic but, if the role is not found, it will look if the role name is actually an available object type on the domain(s), and then suggest its related roles.

This commit also reverts #12133, which provided a (silent) fallback to auto convert an object type to a role name.
2024-03-25 14:39:51 +01:00
..
__init__.py Organise tests into directories 2024-01-17 03:56:35 +00:00
autodoc_util.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
ext_napoleon_pep526_data_google.py Organise tests into directories 2024-01-17 03:56:35 +00:00
ext_napoleon_pep526_data_numpy.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_apidoc.py [lint] add RUFF005 lint (#12068) 2024-03-14 11:26:30 +01:00
test_ext_autodoc_autoattribute.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_autoclass.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_autodata.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_autofunction.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_automodule.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_autoproperty.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_configs.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_events.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_mock.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_autodoc_preserve_defaults.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc_private_members.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autodoc.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_autosectionlabel.py Use long `re` flags 2024-01-19 02:28:06 +00:00
test_ext_autosummary.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_coverage.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_doctest.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_duration.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_extlinks.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_githubpages.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_graphviz.py Use long `re` flags 2024-01-19 02:28:06 +00:00
test_ext_ifconfig.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_imgconverter.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_imgmockconverter.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_inheritance_diagram.py Use long `re` flags 2024-01-19 02:28:06 +00:00
test_ext_intersphinx.py 👌 Improve external role warnings (and revert object fallback) (#12193) 2024-03-25 14:39:51 +01:00
test_ext_math.py Use long `re` flags 2024-01-19 02:28:06 +00:00
test_ext_napoleon_docstring.py [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
test_ext_napoleon.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_todo.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_ext_viewcode.py Organise tests into directories 2024-01-17 03:56:35 +00:00
test_extension.py Organise tests into directories 2024-01-17 03:56:35 +00:00