Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intersphinx: Reduce log severity for ambiguity detection during inventory loading. #12615

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
jayaddison marked this conversation as resolved.
Show resolved Hide resolved
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