Skip to content

Commit

Permalink
intersphinx: Reduce log severity for ambiguity detection during inven…
Browse files Browse the repository at this point in the history
…tory loading (#12615)
  • Loading branch information
jayaddison authored Jul 18, 2024
1 parent f59f761 commit f081136
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Bugs fixed
* #12859, #9743, #12609: autosummary: Do not add the package prefix when
generating autosummary directives for modules within a package.
Patch by Adam Turner.
* #12613: Reduce log severity for ambiguity detection during inventory loading.
Patch by James Addison.

Release 7.4.5 (released Jul 16, 2024)
=====================================
Expand Down
4 changes: 2 additions & 2 deletions sphinx/util/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def load_v2(
inv_item: InventoryItem = projname, version, location, dispname
invdata.setdefault(type, {})[name] = inv_item
for ambiguity in actual_ambiguities:
logger.warning(__("inventory <%s> contains multiple definitions for %s"),
uri, ambiguity, type='intersphinx', subtype='external')
logger.info(__("inventory <%s> contains multiple definitions for %s"),
uri, ambiguity, type='intersphinx', subtype='external')
return invdata

@classmethod
Expand Down
16 changes: 13 additions & 3 deletions tests/test_util/test_util_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,22 @@ def test_read_inventory_v2_not_having_version():
('foo', '', '/util/foo.html#module-module1', 'Long Module desc')


def test_ambiguous_definition_warning(warning):
def test_ambiguous_definition_warning(warning, status):
f = BytesIO(INVENTORY_V2_AMBIGUOUS_TERMS)
InventoryFile.load(f, '/util', posixpath.join)

assert 'contains multiple definitions for std:term:a' not in warning.getvalue().lower()
assert 'contains multiple definitions for std:term:b' in warning.getvalue().lower()
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):
Expand Down

0 comments on commit f081136

Please sign in to comment.