3
0
Fork 0

fix: do not use appname for config extension entry points

This commit is contained in:
Lance Edgar 2025-09-20 12:38:13 -05:00
parent 1daa6ee92e
commit 80b50f05da
4 changed files with 9 additions and 3 deletions

View file

@ -137,6 +137,8 @@ Glossary
The intention is that all config extensions will have been
applied before the :term:`app handler` is created.
See also :ref:`config-extensions`.
config file
A file which contains :term:`config settings<config setting>`.
See also :doc:`narr/config/files`.

View file

@ -56,6 +56,8 @@ to solve the "chicken-vs-egg" problem::
app = config.get_app()
.. _config-extensions:
Extending the Config Object
---------------------------

View file

@ -1040,7 +1040,9 @@ def make_config( # pylint: disable=too-many-arguments,too-many-positional-argum
# maybe extend config object
if extend:
if not extension_entry_points:
extension_entry_points = f"{appname}.config.extensions"
# nb. must not use appname here, entry points must be
# consistent regardless of appname
extension_entry_points = "wutta.config.extensions"
# apply all registered extensions
# TODO: maybe let config disable some extensions?

View file

@ -931,7 +931,7 @@ class TestMakeConfig(FileTestCase):
WuttaConfig.assert_called_once_with(
[], appname="wuttatest", usedb=None, preferdb=None
)
load_entry_points.assert_called_once_with("wuttatest.config.extensions")
load_entry_points.assert_called_once_with("wutta.config.extensions")
# confirm extensions are invoked
load_entry_points.reset_mock()
@ -945,7 +945,7 @@ class TestMakeConfig(FileTestCase):
WuttaConfig.assert_called_once_with(
[], appname="wuttatest", usedb=None, preferdb=None
)
load_entry_points.assert_called_once_with("wuttatest.config.extensions")
load_entry_points.assert_called_once_with("wutta.config.extensions")
foo_cls.assert_called_once_with()
foo_obj.configure.assert_called_once_with(testconfig)
foo_obj.startup.assert_called_once_with(testconfig)