You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: Inventory config 'base_url' no longer works #268
When specifying an inventory with a base_url that is different from the url, the base_url is ignored after the 0.28.0 rework. The rendered cross-reference URL uses the url value, not the base_url value.
A PR would be great, thank you 🙏 I believe we just need to rename base to base_url then, in the Inventory dataclass, do you agree?
For tests, we could add them to the test_handler.py module. They would receive the handler fixture, onto which we would update config.inventories to add an Inventory with both URL and base URL (might need to dataclasses.replace() it if fields are frozen). Then we would create a BytesIO that mocks the bytes of a small inventory (one item), get the URL and config with url, config = handler.get_inventory_urls(), and call handler.load_inventory(mocked_bytes, url, **config), finally asserting that this yields an URL based on the provided base URL.
To mock the inventory bytes, we can create a mkdocstrings.Inventory, .register() one item, and get the bytes with .format_sphinx().
Activity
pawamoy commentedon Apr 3, 2025
Good catch @connesy, thanks for the report!
A PR would be great, thank you 🙏 I believe we just need to rename
basetobase_urlthen, in theInventorydataclass, do you agree?For tests, we could add them to the
test_handler.pymodule. They would receive thehandlerfixture, onto which we would updateconfig.inventoriesto add anInventorywith both URL and base URL (might need todataclasses.replace()it if fields are frozen). Then we would create aBytesIOthat mocks the bytes of a small inventory (one item), get the URL and config withurl, config = handler.get_inventory_urls(), and callhandler.load_inventory(mocked_bytes, url, **config), finally asserting that this yields an URL based on the provided base URL.To mock the inventory bytes, we can create a
mkdocstrings.Inventory,.register()one item, and get the bytes with.format_sphinx().connesy commentedon Apr 3, 2025
Yes, I do. I've already tested this, and it works just fine 👍
I'll make a PR and try adding a test case 🙂
fix: Fix inventory `base_url` being ignored
fix: Fix inventory `base_url` being ignored