summaryrefslogtreecommitdiffstats
path: root/tests/test_util/test_util_inventory.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_util/test_util_inventory.py')
-rw-r--r--tests/test_util/test_util_inventory.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_util/test_util_inventory.py b/tests/test_util/test_util_inventory.py
index 81d31b0..211dc17 100644
--- a/tests/test_util/test_util_inventory.py
+++ b/tests/test_util/test_util_inventory.py
@@ -10,6 +10,7 @@ from sphinx.util.inventory import InventoryFile
from tests.test_util.intersphinx_data import (
INVENTORY_V1,
INVENTORY_V2,
+ INVENTORY_V2_AMBIGUOUS_TERMS,
INVENTORY_V2_NO_VERSION,
)
@@ -48,6 +49,24 @@ def test_read_inventory_v2_not_having_version():
('foo', '', '/util/foo.html#module-module1', 'Long Module desc')
+def test_ambiguous_definition_warning(warning, status):
+ f = BytesIO(INVENTORY_V2_AMBIGUOUS_TERMS)
+ InventoryFile.load(f, '/util', posixpath.join)
+
+ def _multiple_defs_notice_for(entity: str) -> str:
+ return f'contains multiple definitions for {entity}'
+
+ # was warning-level; reduced to info-level - see https://github.com/sphinx-doc/sphinx/issues/12613
+ mult_defs_a, mult_defs_b = (
+ _multiple_defs_notice_for('std:term:a'),
+ _multiple_defs_notice_for('std:term:b'),
+ )
+ assert mult_defs_a not in warning.getvalue().lower()
+ assert mult_defs_a not in status.getvalue().lower()
+ assert mult_defs_b not in warning.getvalue().lower()
+ assert mult_defs_b in status.getvalue().lower()
+
+
def _write_appconfig(dir, language, prefix=None):
prefix = prefix or language
os.makedirs(dir / prefix, exist_ok=True)