3
0
Fork 0

fix: ensure config has no app when constructor finishes

had to move `make_engine_from_config()` out of app handler and define
as a separate function, so that `get_engines()` did not need to
instantiate the app handler.  because if it did, then config
extensions would lose the ability to set a default app handler - er,
they could do it but it would be ignored
This commit is contained in:
Lance Edgar 2024-07-04 06:21:38 -05:00
parent 3ab181b129
commit c3efbfbf7b
6 changed files with 110 additions and 102 deletions

View file

@ -228,6 +228,17 @@ configure_logging = true
config = conf.WuttaConfig(files=[myfile])
logging.config.fileConfig.assert_called_once()
def test_config_has_no_app_after_init(self):
# initial config should *not* have an app yet, otherwise
# extensions cannot specify a default app handler
config = conf.WuttaConfig()
self.assertFalse(hasattr(config, '_app'))
# but after that we can get an app okay
app = config.get_app()
self.assertIs(app, config._app)
def test_setdefault(self):
config = conf.WuttaConfig()